Android studio中的空指针问题!!急

这是一个小游戏的报错,在xml中说是空指针问题,但是我找了很久没有发现问题所在,
程序运行没有错,只是那一块代码的视图不会出现。

具体报错:

图片说明

xml出现问题的代码段:图片说明

第106行代码:MainActivity.getMainActivity().clearScore();

图片说明

第88行代码:startGame();
图片说明

0
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
[急++]C#中的空指针问题
今天刚开始弄C#,遇到了一个很严重的问题。。。就是我再程序中声明一个类,有若干数据成员,并进行批量声明,之后的初始化无法进行,抛出NullReferenceEception,调试信息显示这个类的所有成员属性都是null,为何如此,如何解决呢。。。rnrn附上难看的代码。。。rn[code=csharp]using System;rnusing System.Collections.Generic;rnusing System.Text;rnusing System.Windows.Forms;rnrnnamespace WindowsFormsApplication4rnrn class huffmanrn rn const int MAX_SIZE = 255; //缓冲区大小rn const int MAXLEN_PATH = 256; //最长路径rn const int TABLE_SIZE = 256; //最大权值表大小,不加结束字符rn const int TREE_SIZE = (2 * (TABLE_SIZE + 1) - 1); //哈夫曼树结点个数(加上结束字符) 513rn const int MAX_BIT = 255; //结点的最大编码位数rn const int MAX_INT = (1 << 32 - 1); //最大的整数值 rn const int END_NUM = 256; //结束符对应的num,权值为1rn public char[] Path=new char[MAXLEN_PATH]; //叶子节点的路径,即为叶子节点的编码值,以'\0'作为结束rn rnrn public huffman(string Source_Path,string Encode_Path)rn rn MessageBox.Show(Source_Path +"to\n"+ Encode_Path);rn init();rn InitHuffmanTree();//初始化哈夫曼树rn CalWeights(Source_Path);//计算源文件个字节的权值rn SortWeight();rn CreateHuffman();//创建哈夫曼树rn EnCode(Source_Path, Encode_Path);rn rnrn public huffman(string Source_Path, string Decode_Path,int x)rn rn MessageBox.Show(Source_Path + "to\n" + Decode_Path);rn init();rn InitHuffmanTree();//初始化哈夫曼树rn CalWeights(Source_Path);//计算源文件个字节的权值rn SortWeight();rn CreateHuffman();//创建哈夫曼树rn if (x == 1)rn rn DeCode(Source_Path, Decode_Path);rn rn rn rnrnrn rnrn //转换函数将字符转换为十进制整数rn public int CHARTONUM(char c)rn rn return ((int)c - 48);rn rnrn //类Node定义哈夫曼树节点rn public class Nodern rn public int weights; //结点权值 rn public int left; //左孩子结点 rn public int right; //右孩子结点 rn public int parent; //父结点 rn public int num; //当前对应的数rn public bool live; //当前树是否存在 rnrn //结点权值属性 rn public int Weightrn rn getrn rn return weights;rn rn setrn rn weights = value;rn rn rnrn //左孩子结点属性 rn public int Leftrn rn getrn rn return left;rn rn setrn rn left = value;rn rn rnrn //右孩子结点属性 rn public int RChildrn rn getrn rn return right;rn rn setrn rn right = value;rn rn rnrn //父结点属性 rn public int Parentrn rn getrn rn return parent;rn rn setrn rn parent = value;rn rn rnrn //构造器 rn rn public Node()rn rn weights = 0;rn left = -1;rn right = -1;rn parent = -1;rn num = 0;rn live = true;rn rnrn public Node(int w, int lc, int rc, int p)rn rn weights = w;rn left = lc;rn right = rc;rn parent = p;rn rn rn //定义节点完成rnrn public Node[] HuffmanTree = new Node[TREE_SIZE];rn public void init()//初始化函数rn rn tryrn rn for (int i = 0; i < TABLE_SIZE; i++)rn rn HuffmanTree[i].left = -1;//到这里就抛异常了。。。rn HuffmanTree[i].right = -1;rn HuffmanTree[i].parent = -1;rn HuffmanTree[i].num = i;rn HuffmanTree[i].live = true;rn rn rn catch (NullReferenceException) ;rn rn [/code]
急 android拍照上传空指针
package com.spring.sky.image.upload; rn rnimport android.app.Activity; rnimport android.content.ContentValues; rnimport android.content.Intent; rnimport android.database.Cursor; rnimport android.net.Uri; rnimport android.os.Bundle; rnimport android.os.Environment; rnimport android.provider.MediaStore; rnimport android.util.Log; rnimport android.view.MotionEvent; rnimport android.view.View; rnimport android.view.View.OnClickListener; rnimport android.widget.Button; rnimport android.widget.ImageView; rnimport android.widget.LinearLayout; rnimport android.widget.Toast; rn rn/** rn * @author spring sky rn * Email :vipa1888@163.com rn * QQ: 840950105 rn * @version 创建时间:2012-11-22 上午9:20:03 rn * 说明:主要用于选择文件操作 rn */rn rnpublic class SelectPicActivity extends Activity implements OnClickListener rn rn /*** rn * 使用照相机拍照获取图片 rn */rn public static final int SELECT_PIC_BY_TACK_PHOTO = 1; rn /*** rn * 使用相册中的图片 rn */rn public static final int SELECT_PIC_BY_PICK_PHOTO = 2; rn rn /*** rn * 从Intent获取图片路径的KEY rn */rn public static final String KEY_PHOTO_PATH = "photo_path"; rn rn private static final String TAG = "SelectPicActivity"; rn rn private LinearLayout dialogLayout; rn private Button takePhotoBtn,pickPhotoBtn,cancelBtn; rn rn /**获取到的图片路径*/rn private String picPath; rn rn private Intent lastIntent ; rn rn private Uri photoUri; rn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState); rn setContentView(R.layout.select_pic_layout); rn initView(); rn rn /** rn * 初始化加载View rn */rn private void initView() rn dialogLayout = (LinearLayout) findViewById(R.id.dialog_layout); rn dialogLayout.setOnClickListener(this); rn takePhotoBtn = (Button) findViewById(R.id.btn_take_photo); rn takePhotoBtn.setOnClickListener(this); rn pickPhotoBtn = (Button) findViewById(R.id.btn_pick_photo); rn pickPhotoBtn.setOnClickListener(this); rn cancelBtn = (Button) findViewById(R.id.btn_cancel); rn cancelBtn.setOnClickListener(this); rn rn lastIntent = getIntent(); rn rn rn @Overridern public void onClick(View v) rn switch (v.getId()) rn case R.id.dialog_layout: rn finish(); rn break; rn case R.id.btn_take_photo: rn takePhoto(); rn break; rn case R.id.btn_pick_photo: rn pickPhoto(); rn break; rn default: rn finish(); rn break; rn rn rn rn /** rn * 拍照获取图片 rn */rn private void takePhoto() rn //执行拍照前,应该先判断SD卡是否存在 rn String SDState = Environment.getExternalStorageState(); rn if(SDState.equals(Environment.MEDIA_MOUNTED)) rn rn rn Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);//"android.media.action.IMAGE_CAPTURE" rn /*** rn * 需要说明一下,以下操作使用照相机拍照,拍照后的图片会存放在相册中的 rn * 这里使用的这种方式有一个好处就是获取的图片是拍照后的原图 rn * 如果不实用ContentValues存放照片路径的话,拍照后获取的图片为缩略图不清晰 rn */rn ContentValues values = new ContentValues(); rn photoUri = this.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values); rn intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, photoUri); rn /**-----------------*/rn startActivityForResult(intent, SELECT_PIC_BY_TACK_PHOTO); rn else rn Toast.makeText(this,"内存卡不存在", Toast.LENGTH_LONG).show(); rn rn rn rn /*** rn * 从相册中取图片 rn */rn private void pickPhoto() rn Intent intent = new Intent(); rn intent.setType("image/*"); rn intent.setAction(Intent.ACTION_GET_CONTENT); rn startActivityForResult(intent, SELECT_PIC_BY_PICK_PHOTO); rn rn rn @Overridern public boolean onTouchEvent(MotionEvent event) rn finish(); rn return super.onTouchEvent(event); rn rn rn rn @Overridern protected void onActivityResult(int requestCode, int resultCode, Intent data) rn if(resultCode == Activity.RESULT_OK) rn rn doPhoto(requestCode,data); rn rn super.onActivityResult(requestCode, resultCode, data); rn rn rn /** rn * 选择图片后,获取图片的路径 rn * @param requestCode rn * @param data rn */rn private void doPhoto(int requestCode,Intent data) rn rn if(requestCode == SELECT_PIC_BY_PICK_PHOTO ) //从相册取图片,有些手机有异常情况,请注意 rn rn if(data == null) rn rn Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show(); rn return; rn rn photoUri = data.getData(); rn if(photoUri == null ) rn rn Toast.makeText(this, "选择图片文件出错", Toast.LENGTH_LONG).show(); rn return; rn rn rn String[] pojo = MediaStore.Images.Media.DATA; rn Cursor cursor = managedQuery(photoUri, pojo, null, null,null); rn if(cursor != null ) rn rn int columnIndex = cursor.getColumnIndexOrThrow(pojo[0]); rn cursor.moveToFirst(); rn picPath = cursor.getString(columnIndex); rn cursor.close(); rn rn Log.i(TAG, "imagePath = "+picPath); rn if(picPath != null && ( picPath.endsWith(".png") || picPath.endsWith(".PNG") ||picPath.endsWith(".jpg") ||picPath.endsWith(".JPG") )) rn rn lastIntent.putExtra(KEY_PHOTO_PATH, picPath); rn setResult(Activity.RESULT_OK, lastIntent); rn finish(); rn else rn Toast.makeText(this, "选择图片文件不正确", Toast.LENGTH_LONG).show(); rn rn rn rn
android studio run的时候出现空指针错误
Error:Execution failed for task ':Disentanglement:transformNative_libsWithStripDebugSymbolForDebug'.rn> java.lang.NullPointerException (no error message)rnrnrn以上是错误信息,这是什么情况...
android studio 环境下的DataBase的getWritableDatabase()报错空指针
遇到一个问题把eclipse项目转醒目成as ,rnrnpublic synchronized MyDbHelper open() throws Exceptionrn if(mDbHelper == null)rn mDbHelper = new DatabaseHelper(mContext);rn mDb = mDbHelper.getWritableDatabase();rn rn return this;rn rnrn在eclipse这里是好的,但是as项目里头得到的mdb却是空的,一直context不为空,dbhelper也是不为空,是as的限制吗还是什么情况?
android空指针问题
public class FiveActivity extends Activity rn private TextView textView;rn rn private Handler handler = new Handler()rn public void handleMessage(android.os.Message msg) rn rn ;rn ;rn rn @Overridern protected void onCreate(Bundle savedInstanceState) rn // TODO Auto-generated method stubrn super.onCreate(savedInstanceState);rn setContentView(R.layout.five);rn textView = (TextView) findViewById(R.id.textview);rn new Thread()rn public void run() rn try rn Thread.sleep(2000);rn rn handler.post(new Runnable() rn rn @Overridern public void run() rn // TODO Auto-generated method stubrn textView.setText("ok");rn rn );rn catch (InterruptedException e) rn // TODO Auto-generated catch blockrn e.printStackTrace();rn rn rn .start();rn rnrnrn报错是textView.setText("ok");空指针rnrnrnrn
空指针问题,急。
int main(int argc, char* argv[])rn void *HedInfo;rn //初始化HedInforn printf("AAA ") ;rn memset(HedInfo,0,sizeof(HedInfo));rn printf("BBB ") ;rn char aa[3]='a','b','d';rn HedInfo =aa;rn return 0;rnrn这段代码在有C++BUILDERD的环境中可以运行,但是在没有开发环境的机器上报错。说程序模块错误。不知道是为什么。
Android空指针问题
Android解析xml获取了控件的应用,但在使用控件的时候总是报空指针异常,这种现象时有时无,以前clean一下就没问题了,现在clean了也没有用,不知道有遇上这样的问题的没,还请指教这种现象的原因及解决办法。
android程序运行空指针问题。
调试程序报错空指针。rn我是在网上找别人的代码。rnrn[color=#FF0000]Mylocation.java[/color]rn rn rnrnpackage com.swift.mylocation;rn rnimport java.io.IOException;rn import java.util.List;rn import java.util.Locale;rn rnimport android.app.PendingIntent;rn rnimport android.content.Context;rn import android.content.Intent;rn rnimport android.location.Address;rn import android.location.Criteria;rn import android.location.Geocoder;rn import android.location.Location;rn import android.location.LocationListener;rn import android.location.LocationManager;rn import android.os.Bundle;rn rn rn rnimport android.widget.TextView;rn import android.widget.Toast;rn rnimport com.google.android.maps.GeoPoint;rn import com.google.android.maps.MapActivity;rn import com.google.android.maps.MapController;rn import com.google.android.maps.MapView;rn import com.google.android.maps.Overlay;rn import com.swift.mylocation.R;rn rnpublic class Mylocation extends MapActivity rn rn MapController mapController;rn List overlays;rn MyPositionOverlay positionOverlay;rn LocationManager locationManager;rn MapView myMapView;rn rn final String PROXIMITY_ALERT = new String(rn "android.intent.action.proximityalert");rn rn @SuppressWarnings("deprecation")rn @Overridern public void onCreate(Bundle icicle) rn super.onCreate(icicle);rn setContentView(R.layout.main);rn rn myMapView = (MapView) findViewById(R.id.myMapView);rn rn mapController = myMapView.getController();rn rn myMapView.setSatellite(true);rn myMapView.setStreetView(true);rn myMapView.displayZoomControls(false);rn rn mapController.setZoom(17);rn rn positionOverlay = new MyPositionOverlay();rn overlays = myMapView.getOverlays();rn overlays.add(positionOverlay);rn rn Criteria criteria = new Criteria();rn criteria.setAccuracy(Criteria.ACCURACY_FINE);rn criteria.setAltitudeRequired(true);rn criteria.setBearingRequired(false);rn criteria.setCostAllowed(false);rn criteria.setPowerRequirement(Criteria.POWER_LOW);rn locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);rn rn String provider = locationManager.getBestProvider(criteria, true);rn rn Location location = locationManager.getLastKnownLocation(provider);rn rn updateWithNewLocation(location);rn rn locationManager.requestLocationUpdates(provider, 2000, 10,rn locationListener);rn rn setProximityAlert();rn rn rn rn private final LocationListener locationListener = new LocationListener() rn @Overridern public void onLocationChanged(Location location) rn updateWithNewLocation(location);rn rn rn @Overridern public void onProviderDisabled(String provider) rn updateWithNewLocation(null);rn rn rn @Overridern public void onProviderEnabled(String provider) rn rn rn @Overridern public void onStatusChanged(String provider, int status, Bundle extras) rn rn ;rn rn rn rn rn void setProximityAlert() rn rn double lat = 31.620356666666666;rn double lng = 121.38631333333333;rn float radius = 50f;rn long expiration = -1;rn rn Intent intent = new Intent(PROXIMITY_ALERT);rn intent.setAction(PROXIMITY_ALERT);rn PendingIntent proximityIntent = PendingIntent.getBroadcast(this, -1,rn intent, 0);rn rn locationManager.addProximityAlert(lat, lng, radius, expiration,rn proximityIntent);rn rn rn rn /** Update UI with a new location */rn private void updateWithNewLocation(Location location) rn rn String latLongString;rn TextView myLocationText;rn myLocationText = (TextView) findViewById(R.id.myLocationText);rn String addressString = "No address found";rn if (location != null) rn rn positionOverlay.setLocation(location);rn rn Double geoLat = location.getLatitude() * 1E6;rn Double geoLng = location.getLongitude() * 1E6;rn GeoPoint point = new GeoPoint(geoLat.intValue(), geoLng.intValue());rn mapController.animateTo(point);rn rn double lat = location.getLatitude();rn double lng = location.getLongitude();rn latLongString = "Lat:" + lat + "\nLong:" + lng;rn double latitude = location.getLatitude();rn double longitude = location.getLongitude();rn rn Geocoder gc = new Geocoder(this, Locale.CHINA);rn try rn List addresses = gc.getFromLocation(latitude,rn longitude, 1);rn StringBuilder sb = new StringBuilder();rn if (addresses.size() > 0) rn Address address = addresses.get(0);rn for (int i = 0; i < address.getMaxAddressLineIndex(); i++)rn sb.append(address.getAddressLine(i)).append("\n");rn sb.append(address.getCountryName());rn sb.append(address.getLocality()).append("\n");rn rn addressString = sb.toString();rn catch (IOException e) rn rn else rn latLongString = "No location found";rn rn myLocationText.setText("Your Current Position is:\n" + latLongStringrn + "\n" + addressString);rn rn Toast.makeText(this,this.getIntent().getStringExtra(PROXIMITY_ALERT) , Toast.LENGTH_LONG);rn rn rn @Overridern protected boolean isRouteDisplayed() rn return true;rn rn rn rnrn rn rn[color=#FF0000]MyPostionOverlay.java[/color]rn rn rn rnrnpackage com.swift.mylocation;rn rnimport android.graphics.Canvas;rn import android.graphics.Paint;rn import android.graphics.Point;rn import android.graphics.RectF;rn import android.location.Location;rn rnimport com.google.android.maps.GeoPoint;rn import com.google.android.maps.MapView;rn import com.google.android.maps.Overlay;rn import com.google.android.maps.Projection;rn rnpublic class MyPositionOverlay extends Overlay rn rn Location location, mlocation;rn final Double lat = 31.620356666666666 * 1E6,rn lon = 121.38631333333333 * 1E6;rn final int ccc = 50;rn private final int mRadius = 5;rn rn /**rn * @return the locationrn */rn public Location getLocation() rn return location;rn rn rn /**rn * @param locationrn * the location to setrn */rn public void setLocation(Location location) rn this.location = location;rn rn rn @Overridern public void draw(Canvas canvas, MapView mapView, boolean shadow) rn Projection projection = mapView.getProjection();rn if (shadow == false) rn rn Double latitude = location.getLatitude() * 1E6;rn Double longitude = location.getLongitude() * 1E6;rn GeoPoint geoPoint, gp;rn geoPoint = new GeoPoint(latitude.intValue(), longitude.intValue());rn gp = new GeoPoint(lat.intValue(), lon.intValue());rn rn Point point = new Point();rn projection.toPixels(geoPoint, point);rn RectF oval = new RectF(point.x - mRadius, point.y - mRadius,rn point.x + mRadius, point.y + mRadius);rn rn Paint paint = new Paint();rn paint.setARGB(250, 255, 0, 0);rn paint.setAntiAlias(true);rn paint.setFakeBoldText(true);rn Paint backPaint = new Paint();rn backPaint.setARGB(175, 50, 50, 50);rn backPaint.setAntiAlias(true);rn RectF backRect = new RectF(point.x + 2 + mRadius, point.y - 3rn * mRadius, point.x + 65, point.y + mRadius);rn rn Point center = new Point();rn rn projection.toPixels(gp, center);rn rn Paint ccp = new Paint();rn ccp.setARGB(250, 0, 0, 255);rn ccp.setAntiAlias(true);rn rn canvas.drawCircle(center.x, center.y, ccc, ccp);rn rn canvas.drawOval(oval, paint);rn canvas.drawRoundRect(backRect, 5, 5, backPaint);rn canvas.drawText("Here I Am", point.x + 2 * mRadius, point.y, paint);rn rn rn super.draw(canvas, mapView, shadow);rn rn rn @Overridern public boolean onTap(GeoPoint point, MapView mapView) rn return false;rn rn rn
Android程序空指针问题
问题出现的截图如图1:rn[img=https://img-bbs.csdn.net/upload/201508/24/1440424964_626709.png][/img]rn我在MainActivity中定义数据库:rn[img=https://img-bbs.csdn.net/upload/201508/24/1440424962_366952.png][/img]rn然后将他传入AppActivity中:rn[img=https://img-bbs.csdn.net/upload/201508/24/1440424987_776251.png][/img]rn接下来出错的49行,56行,102行如图所示,请问各位大神们,问题可能出在哪里呢?rn[img=https://img-bbs.csdn.net/upload/201508/24/1440425069_171809.png][/img]rn[img=https://img-bbs.csdn.net/upload/201508/24/1440425010_789817.png][/img]
空指针问题???急
空指针 但是为什么 我把我的.jsp and bean paste 出来了帮我看看,谢谢了rnjava.lang.NullPointerExceptionrn myfirstbean.DataOperate.insertSQLCommand(DataOperate.java:96)rn org.apache.jsp.register_jsp._jspService(register_jsp.java:87)rn org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rn org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)rn org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)rn org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)rn javax.servlet.http.HttpServlet.service(HttpServlet.java:856)rnrnrigister.jsprnrnrnrn<%@page language="java"%>rn rn<%@ page import="java.lang.*"%>rnrn<% rn dataOperate.openConnection();rn rn String name,Anonymous,email,descrip,num,cod;rn int code,telnumber;rn rn rn cod=request.getParameter("co");rn num=request.getParameter("telnumb");rnname=request.getParameter("na");rnAnonymous=request.getParameter("Anonymo");rndescrip=request.getParameter("descr");rncode=Integer.parseInt(cod);rntelnumber=Integer.parseInt(num);rnemail=request.getParameter("ema");rnrnSystem.out.println(name);rnSystem.out.println(Anonymous);rnrn rndataOperate.setName(name);dataOperate.setAnonymous(Anonymous);dataOperate.setCode(code);rndataOperate.setEmail(email);dataOperate.setTel(telnumber);dataOperate.setDescription(descrip);rnrnString inSertCommand="insert into Customer Values('"+dataOperate.getName()+"','"+dataOperate.getAnonymous()+"',"+dataOperate.getCode()+",'"+dataOperate.getEmail()+"',"+dataOperate.getNumber()+",'"+dataOperate.getDescription()+"')";rnrn String execut="inSertCommand ";rn dataOperate.insertSQLCommand(execut );rnrnrn%>rn<%out.print("注册成功,恭喜你");%>rnrnrnrnrnrnrnpackage myfirstbean;rnimport java.sql.*;rnpublic class DataOperate rn rn Connection theConnection;rn Statement theStatement;rn ResultSet theResult;rn rn String theDataSource,theUser,thePassword,theName,theAnonymous,rn theEmail,description,insertCommand;rnrn int telNumb,theCode;rnrn //设置和获得参数rn public void setName(String name)rn rn theName=name;rn rn public String getName()rn rn return theName;rn rn rn rn public void setAnonymous(String Anonymous)rn rn theAnonymous=Anonymous;rn rn public String getAnonymous()rn rn return theAnonymous;rn rnrn public void setCode(int code)rn rn theCode=code;rn rnrn public int getCode()rn rn return theCode;rnrn rn rn public void setEmail(String email)rn theEmail=email;rn rn public String getEmail()rn return theEmail;rn rnrn public void setTel(int telnumber)rn telNumb= telnumber;rn rn public int getNumber()rnrn return telNumb;rn rnrn public void setDescription(String descrip)rn rn description=descrip;rn rn rnrn public String getDescription()rnrn return description;rnrn rnrn static void openConnection()rnrn theDataSource= "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=mydata";rn theUser="sa";rn thePassword=" ";rn rn tryrnrn Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();rn theConnection=DriverManager.getConnection(theDataSource,theUser,thePassword);rn theStatement=theConnection.createStatement();rn rn catch(Exception e)rn e.printStackTrace();rn System.out.println("Error Trace in getConnection() : " + e.getMessage());rn rn rn rn rn static void insertSQLCommand(String inSertCommand)rnrn tryrnrn theResult=theStatement.executeQuery(inSertCommand);rn catch(SQLException e) e.printStackTrace();rn System.out.println("Error Trace in executeQuery() : " + e.getMessage());rn rnrnrn rnrn rnrnrn
android 空指针的问题
在我的MainActivity的onCreate方法里面rn现setContentView(R.layout.main)加载main.xml,rn然后layout = (LinearLayout)findViewById(R.id.change_page); rnView view = getLayoutInflater().inflate(R.layout.main_tab1, null); rnLayoutParams params = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT); rn layout.addView(view, params); rn之后我在另一个方法里面rntab1_listView = (ListView)findViewById(R.id.main_tab1_list);rnint[] colors = Color.WHITE,Color.WHITE;rn tab1_listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));rn然后执行的时候就在tab1_listView.setDivider(new GradientDrawable(Orientation.RIGHT_LEFT, colors));这一行报空指针错误,我的main.xml和main_tab1两个xml文件都正常,没有错误,实在不知道哪里的问题,请大神指教
android 空指针问题
[b][i][color=#FF0000]MainActivity.java[/color][/i][/b]rnrnpublic class MainActivity extends Activity rn private ListView news_list;rn private String IMOOCURL="http://www.imooc.com/api/teacher?type=4&num=30";rnrn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn requestWindowFeature(Window.FEATURE_NO_TITLE);rn setContentView(R.layout.activity_main);rnrn news_list= (ListView) this.findViewById(R.id.id_newslist);rn new NewsThread().execute(IMOOCURL);rn rnrn class NewsThread extends AsyncTask>rnrn @Overridern protected List doInBackground(String... params) rn List alldata= getJSONDate(params[0]);rn return alldata;rn rnrn @Overridern protected void onPostExecute(List newsBeans) rn super.onPostExecute(newsBeans);rn ListAdapter adapter = new ListAdapter(MainActivity.this,newsBeans,news_list);rn news_list.setAdapter(adapter);rn rnrn //从网站解析得到数据rn private List getJSONDate(String param)rn List alldata = new ArrayList<>();rn String result="";rn try rn InputStream is = new URL(param).openStream();rn InputStreamReader isr = new InputStreamReader(is,"UTF-8");rn BufferedReader br = new BufferedReader(isr);rn String line="";rn while ((line=br.readLine())!=null)rn result=result+line;rn rn JSONObject JSON_object = new JSONObject(result);rnrn JSONArray JSON_array =JSON_object.getJSONArray("data");rn for (int i=0;i alldata;rn private LayoutInflater inflater;rn private Imageloader imageloader;rnrn private int startData; //第一个可见项rn private int endData; //最后一个可见项rn private String URLS[]; //加载所有图片的URLrnrn private boolean isFirst; //是否是第一次加载rn public ListAdapter(Context context,List list,ListView listView)rn this.alldata=list;rn inflater =LayoutInflater.from(context);rn imageloader=new Imageloader(listView);rnrn URLS = new String[list.size()];rn for (int i=0;i0)rn imageloader.loadImages(startData,endData,URLS);rn isFirst=false;rn rn rn
Android 控件 空指针问题
今天遇到一个特别奇葩的空指针, 控件有声明 有初始化 也没有在声明出写上=null; 但就是一运行,点击button就崩了 报错:空指针异常一般情况,空指针异常是没有初始化,或者控件有属性错误等一些小问题,这些虽然都派出了,但是万万没想到,坑是自己造下的 就在图中的绿色部分, 引用的文件和activity写混了,(这是修改以后的) 因为是直接复制的, 然后显然的是,因为你的布局
Android空指针的问题。。
android 空指针搞了二天了,还是没找到错误,知道那里报空指针但不知道怎么改rnrn有空的哥们帮帮忙qq517835354rnrnrn报错代码:rnrnrn[color=#FF0000]GastronomyList.class:[/color]rn[code=java]/**rn * 一切为了测试rn */rn private ExpandTabView expandTabView;rn private ArrayList mViewArray = new ArrayList();rn private ViewMiddle viewMiddle;rnrn rn rn private void init() rnrn tv_menu1 = (TextView)findViewById(R.id.tv_menu1);rn tv_menu2 = (TextView)findViewById(R.id.tv_menu2);rn tv_menu2.setVisibility(View.GONE);rn tv_menu3 = (TextView)findViewById(R.id.tv_menu3);rn rn tv_menu1.setText(getIntent().getStringExtra("menu"));rn //获取传过来的分类Idrn categoryId = getIntent().getStringExtra("id");rn rn tv_menu1.setOnClickListener(this);rn //tv_menu2.setOnClickListener(this);rn tv_menu3.setOnClickListener(this);rn rn View view = LayoutInflater.from(context).inflate(R.layout.bottom_bar, null);rn rn rn lv_list = (ListView)findViewById(R.id.lv_list_ms);rn rn rn list_list = new ArrayList>();rnrn rn rn list_data3 = new ArrayList>();rn for(int i=0;i map = new HashMap();rn map.put("name", orderNames[i]);rn map.put("dictate", orderDictates[i]);rn list_data3.add(map);rn rn rnrn width = getWindowManager().getDefaultDisplay().getWidth();rn rn rn rn @Overridern protected void onCreate(Bundle savedInstanceState) rn super.onCreate(savedInstanceState);rn setContentView(R.layout.activity_gastronomy_list);rn init();rn rn rn initView();rn initVaule();rn initListener();rn //getProductCategoryList(categoryId);rn getFLLsit();rn getDictList();rn getProductList(categoryId,busiareaId,order,pageNo*BASE,(pageNo+1)*BASE);rn rn rn rn /**rn * 一切为了测试rn * @param 唉 命苦rn */rn private void initView() rnrn expandTabView = (ExpandTabView) findViewById(R.id.expandtab_view);rn // viewLeft = new ViewLeft(this);rn// getProductCategoryList("");rn viewMiddle = new ViewMiddle(this);rn // viewRight = new ViewRight(this);rnrn rnrn rn private void initVaule() rnrn // mViewArray.add(viewLeft);rn mViewArray.add(viewMiddle);rn // mViewArray.add(viewRight);rn ArrayList mTextArray = new ArrayList();rn // mTextArray.add("距离");rn mTextArray.add("美食");rn if(mViewArray!=null)rn Log.i("什么玩意", ""+mViewArray.size());rn elsern Log.i("什么玩意", "呵呵");rn rn // mTextArray.add("距离");rn expandTabView.setValue(mTextArray, mViewArray); //这行报错 空指针rn // expandTabView.setTitle(viewLeft.getShowText(), 0);rn // expandTabView.setTitle(viewMiddle.getShowText(), 1);rn // expandTabView.setTitle(viewRight.getShowText(), 2);rnrn rnrn private void initListener() rnrn // viewLeft.setOnSelectListener(new ViewLeft.OnSelectListener() rn //rn // @Overridern // public void getValue(String distance, String showText) rn // onRefresh(viewLeft, showText);rn // rn // );rnrn viewMiddle.setOnSelectListener(new ViewMiddle.OnSelectListener() rnrn @Overridern public void getValue(String showText) rnrn onRefresh(viewMiddle, showText);rnrn rn );rnrn // viewRight.setOnSelectListener(new ViewRight.OnSelectListener() rn // @Overridern // public void getValue(String distance, String showText) rn // onRefresh(viewRight, showText);rn // rn // );rnrn rnrn private void onRefresh(View view, String showText) rnrn expandTabView.onPressBack();rn int position = getPositon(view);rn if (position >= 0 && !expandTabView.getTitle(position).equals(showText)) rn expandTabView.setTitle(showText, position);rn rn Toast.makeText(getApplicationContext(), showText, Toast.LENGTH_SHORT).show();rnrn rnrn private int getPositon(View tView) rn for (int i = 0; i < mViewArray.size(); i++) rn if (mViewArray.get(i) == tView) rn return i;rn rn rn return -1;rn rn [/code]rnrn[color=#800000]报错信息:[/color]rn[img=https://img-bbs.csdn.net/upload/201410/07/1412612607_215126.jpg][/img]
android 开发中的奇怪空指针
今天测试组突然遇到很奇怪的错误。我还是那个态度,有错误就拿日志给我。这样才能解决。然后日志就来了。排查一下立马定位错误日志为:如下。瞬间懵逼,日志原因很明确空指针。然后继续找相关代码。找到3遍愣是没找到和我代码中相关的代码。都是api层的日志提醒。这怎么看。我就在想什么时候会出现这个问题呢,最终通过各种办法,终于了解到。这个是由于我在adapter的getView() 中返回了null导致的。至于为
关于wtk中的空指针的问题(急)
小弟今年大四,在做毕业设计的时候才接触j2me,现在手里有老师给的一个例子,可以在模拟器下执行,但是当我自己用wtk1.04时,可以进行build,但是不可以run,一旦运行就会报这样的问题:rnEmulator: Missing JAR file.rnrnEmulator command: c:\WTK104\wtklib\devices\Series_60_MIDP_SDK_for_Symbian_OS_v_1_0\bin\Series_60_MIDP_SDK_for_Symbian_OS_v_1_0\Epoc32\release\wins\udeb\kmidp_debug.exe -parent_port 2810 -classpath c:\WTK104\wtklib\devices\Series_60_MIDP_SDK_for_Symbian_OS_v_1_0\lib\Series_60_MIDP_SDK_for_Symbian_OS_v_1_0\j2me_debug.zip -descriptor c:\tmp\midp\wodedaishu.jad wodedaishurnrnconnectionsStartuprnjava.lang.NullPointerExceptionrn at com.symbian.midp.compatibility.runtime.MIDletExecutor.runMIDlet(+131)rn at com.symbian.midp.compatibility.runtime.MIDletMain.runFirstMIDlet(+77)rn at com.symbian.midp.compatibility.runtime.MIDletMain.run(+346)rn at com.sun.midp.midlet.Main.main(+56)rnconnectionsShutdown()rnrn小弟所用的环境是wtk1.04,jdk1.4.1和Series_60_MIDP_SDK_for_Symbian_OS_v_1_0,希望各位大虾可以帮小弟看下这个问题,谢谢
getSession()空指针问题,急急急
我用struts2框架写一个web程序,有一个添加页面,有些文本框是可以选择不填,提交表单后在action中用rnActionContext.getContext().getSession().put("qaneednum",qa.getNeednum());将一个文本框中的值放入session中(这个文本框可以选择不填),然后调用一个执行方法,在这个方法里用rnString neednumstr=ctx.getSession().get("qaneednum").toString(); 得到这个值。rn我之前的几个模块一直都这么用都没问题,但是现在这个不填的时候会报空指针异常的错,要纠结死了,到底为什么啊,请大牛知道。
android LayoutInflater.from(mycontext)空指针问题
大家请看图rn[img=https://img-bbs.csdn.net/upload/201306/20/1371696459_85385.jpg][/img]rn(以上创建一个layout视图,并且在视图中找到一个listview)rnrn[img=https://img-bbs.csdn.net/upload/201306/20/1371696666_280547.jpg][/img]rn(xml的布局文件)rnrnrn为什么在运行的时候,找不到mylistview呢,明明是存在的,怎么返回的是空的呢???奇怪了现在!!!1rn请大家相互帮忙解决!!!!!谢谢谢谢!!非常感谢!!!rn
android程序运行报错空指针问题
调试程序报错空指针,求广大网友帮忙看看怎么回事 MainActivity.java的部分代码: public void initView() { title = (TextView) findViewById(R.id.title); phonenumber = (TextView) findViewById(R.id.phonenumbertxt); helpinfotext 
java3d中的空指针问题。
Canvas3D c = new Canvas3D(null);rn add("Center", c);rnrnBranchGroup scene = createSceneGraph(filename);rn SimpleUniverse u = new SimpleUniverse(c);rnrn显示错误是java.lang.NullPointerException: Canvas3D: null GraphicsConfigurationrnrn但这是java3D教程中的示例代码。哪位大哥给指点一下谢谢。
一个空指针访问问题(急)
程序如下:rnpublic class NewMap rn ViewNode node[]=new ViewNode[4];//声明ViewNode对象的数组rn public NewMap()rn rn Edge edge[][]=new Edge[4][];//声明Edge对象数组rn edge[0]=new Edge[]new Edge(200,node[2]),new Edge(300,node[3]);//实例化对象edgern edge[1]=new Edge[]new Edge(200,node[1]); 将node对象作为rn edge[2]=new Edge[]new Edge(200,node[0]),new Edge(300,node[1]); 参数传入rn edge[3]=new Edge[]new Edge(300,node[2]),new Edge(300,node[0]); rn for(int i=0;i<4;i++)rn rn node[i]=new ViewNode(edge[i]);//实例化对象node,将edge对象作为参数传入rn rn rn rn//////////Edge类rnpublic class Edge rn public int wayLength;rn ViewNode viewnodenext=null;rn rn public Edge(int WayLength,ViewNode nextViewNode)rn rn rn wayLength=WayLength;rn viewNodeNext=nextViewNode;rn }rn}rn////////ViewNode类rnpublic class ViewNode rn rn Edge edge[]=new Edge[4];rn public ViewNode(Edge _edge[]) rn rn for(int i=0;i<_edge.length;i++)rn rn edge[i]=_edge[i];rn rn rn}rn问题是在NewMap类里面,在实例化Edge类的时候,需要将Node类对象作为参数传入,但Node类在后面才被实例化。也就是说我在访问Edge类的viewNodeNext成员的时候,viewNodeNext还没有指向一个ViewNode的实例。会出现java.lang.NullPointerException异常。rn如果先实例化ViewNode类,但ViewNode类里又需要传入Edge类的实例,Edge类又没被实例化。又同样会出现java.lang.NullPointerException异常。rn总的来说就是,相互调用对象,但实例化的先后顺序不一样,不管先实例化哪个对象都会出现java.lang.NullPointerException异常。rnrn希望有人帮忙提供方案解决问题。
高分急求:空指针问题!
做一个添加记录的程序,填好表单一点提交报下列错误:rn500 Servlet Exceptionrnjava.lang.NullPointerExceptionrn at Beanes.datacon.closeConn(datacon.java:79)rn at _backadmin._btnews_0save__jsp._jspService(/backadmin/btnews_save.jsp:5)rn at com.caucho.jsp.JavaPage.service(JavaPage.java:75)rn at com.caucho.jsp.Page.pageservice(Page.java:549)rn at com.caucho.server.dispatch.PageFilterChain.doFilter(PageFilterChain.java:184)rn at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:149)rn at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:221)rn at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:257)rn at com.caucho.server.port.WorkerThread.run(WorkerThread.java:123)rn at java.lang.Thread.run(Thread.java:534)rnrnrn--------------------------------------------------------------------------------rnResin 3.0.0-beta (built Thu Feb 13 18:21:13 PST 2003) rnrn但打开数据库填写的记录已经写到库里面了,经过加注释发现报错的地方是:rntryrn if (DB.executeUpdate(sql)) rn flag = true;rn rn catch (Exception _ex)rn flag = false;rn rn rn DB.closeConn();rnrn请求各位大虾,帮帮我,实在是不知道如何解决?
Android Studio中报错的问题
(1) 在32位系统下,往Android Studio中导入一个已有的项目后,如果运行时报错如下: Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Invalid maximum heap size: -Xmx4g The s...
android studio中的preview问题
为什么 有的是这样的:rn[img=https://img-bbs.csdn.net/upload/201610/11/1476173490_402400.png][/img]rnrn也有的这样的:rn[img=https://img-bbs.csdn.net/upload/201610/11/1476173509_914356.png][/img]rnrnrn其实我想要的就是下面这种有手机样式的比较的实在。rnrnrn怎么设置这了两种选择呢?
Android Studio开发环境中的问题
记录下我在Android Studio环境下遇到的各种问题: 1、导入原来的Eclipse工程,编译失败 提示各种各样的错误,大概有这几个: (1)代码中存在某些类继承了apache http相关类库中的类,编译提示找不到这些类,比如 org.apache.http.impl.conn.DefaultResponseParser  【原因】 Android 6.0 中移除了Apach
android studio中图片格式的问题
最近才开始用android studio,准备把遇到的一些问题记下来。今天创建项目的时候直接用一个jpg格式的图片更名为ic_launcher.png,然后直接替换结果就报错了 Error:Execution failed for task ':app:mergeDebugResources'. > Crunching Cruncher ic_launcher.png failed,
Android studio 使用中的问题
gradle 的代理配置问题(gradle sync会出现pom文件下载不成功的问题) 由于gradle不能使用socks代理所以采用Privoxy 进行https代理socks, privoxy(linux) 使用:编辑配置文件/etc/privoxy/config forward-socks5t / 127.0.0.1:1080 . listen-...
项目在android studio中的问题
】项目上有红叉叉 原因1: 配置文件有错,我的是activity嵌套了activity 并没有报错 不容易发现】项目运行没有问题,安装outout/apk下的apk打不开问题第一步 .把Android studio的 instant run给关掉,setting —– 搜索instant run 第二歩 删除项目下的build文件——clean——运行 如果还不行 把整个工程
fragment中的空指针问题
今天遇到一个很奇怪的空指针问题,看了好久问了大牛才知道,为了避免大家遇到同样地问题故在这里指出我遇到的问题,首先我有一个自定义控件gridview,在里面要调用fragment中的一个方法。          在activity中将fragment引入,fragment中通过new gridview得到一个自定义控件的实例传入getactivity()将activity的对象传入,然后setad
android测试中,出现空指针怎么办?如何防止空指针错误。
这几天开始学习android的事务操作,可是在测试的过程中,总是出现空指针错误。如下是代码和测试的结果。rnpackage com.Liray.db;rnrnimport java.util.List;rnrnimport android.test.AndroidTestCase;rnimport android.util.Log;rnrnimport com.Liray.domain.Person;rnimport com.Liray.service.DBOpenHelper;rnimport com.Liray.service.PersonService;rnrnrnpublic class PersonServiceTest extends AndroidTestCase rn private static final String TAG = "PersonServiceTest";rnrn public void testCreateDB() throws Throwablern DBOpenHelper dbOpenHelper = new DBOpenHelper(this.getContext());rn dbOpenHelper.getWritableDatabase();//第一次调用该方法就会创建数据库rn rn rn public void testSave() throws Throwablern PersonService personService = new PersonService(this.getContext());rn Person person = new Person();rn person.setName("xiaoxiao");rn personService.save(person);rn rn person = new Person();rn person.setName("zhangliming");rn personService.save(person);rn rn person = new Person();rn person.setName("libaobao");rn personService.save(person);rn rn person = new Person();rn person.setName("taobao");rn personService.save(person);rn rn rn public void testUpate() throws Throwablern PersonService personService = new PersonService(this.getContext());rn Person person = personService.find(1); rn person.setName("lili");rn personService.update(person);rn rn rn public void testDelete() throws Throwablern PersonService personService = new PersonService(this.getContext());rn personService.delete(1);rn rn rn public void testFind() throws Throwablern PersonService personService = new PersonService(this.getContext());rn Person person = personService.find(1);rn Log.i(TAG, person.toString());rn rn rn public void testGetScrollData() throws Throwablern PersonService personService = new PersonService(this.getContext());rn List persons = personService.getScrollData(0, 3);rn for(Person person : persons)rn Log.i(TAG, person.toString());rn rn rn rn public void testGetCount() throws Throwablern PersonService personService = new PersonService(this.getContext());rn Log.i(TAG, personService.getCount()+"");rn rnrnrn[img=https://img-bbs.csdn.net/upload/201308/04/1375603017_545071.jpg][/img]rn
新手求问Android Studio的问题 急!!!!
我运行activity 一直显示keeps sto[img=https://img-bbs.csdn.net/upload/201712/12/1513012322_867872.png][/img]pping 而且显示没有错误 求解!!!!!!!!!!
android 空指针避免
空指针的避免方法: 1. 不要在Set中使用null 2. 不要把null作为map的键值。 3. 尽可能的尽早检查,如果为 null 不执行或者 结束本方法 4. 遇到必须的参数,比如通过intent传参到新的目标 activity,而且一定需要这个参数,那么在新的目标activity中判断是否有参数 if(getIntent() == null) throw new NullPoin
android listview 报错 空指针
这问题 困扰了我3天了 不知道为什么 求大神指点n上代码nn这是onCreate里面的n // 商品 listviewn n lv_friend=(ListView) findViewById(R.id.LV_store);n adapter=new Myadapter(this, getdatas());n System.out.println("adapter+++++++++++"+adapter);n lv_friend.setAdapter(adapter);n n n n private List getdatas() n List list=new ArrayList();n GetDataType data1=new GetDataType();n data1.setIv_portrait(R.drawable.ic_launcher);n data1.setName("杨幂");n data1.setSignature("喜欢我就来找我啊");n list.add(data1);n n GetDataType data2=new GetDataType();n data2.setIv_portrait(R.drawable.ic_launcher);n data2.setName("范冰冰");n data2.setSignature("我在这里等你哦");n list.add(data2);n n GetDataType data3=new GetDataType();n data3.setIv_portrait(R.drawable.ic_launcher);n data3.setName("唐嫣");n data3.setSignature("来追我呀,呵呵");n list.add(data3);n n GetDataType data4=new GetDataType();n data4.setIv_portrait(R.drawable.ic_launcher);n data4.setName("李小璐");n data4.setSignature("386562,加我好友呀");n list.add(data4);n n GetDataType data5=new GetDataType();n data5.setIv_portrait(R.drawable.ic_launcher);n data5.setName("柳岩");n data5.setSignature("帅哥,过来一下");n list.add(data5);n return list;n n这是Myadapternpackage com.android.workapp;nnimport java.util.List;nnimport android.content.Context;nimport android.view.View;nimport android.view.ViewGroup;nimport android.widget.BaseAdapter;nimport android.widget.ImageView;nimport android.widget.TextView;nnpublic class Myadapter extends BaseAdaptern private List mData;n private Context mcontext;n private int mid;n public Myadapter(Context context,List data)n this.mcontext=context;n this.mData=data;n n//获取列表列的数量n @Overriden public int getCount() n return mData.size();n n//根据postion获取item的数据n @Overriden public Object getItem(int position) n return mData.get(position);n n//获取position对应的idn @Overriden public long getItemId(int position) n return position;n n//创建item的视图n @Overriden public View getView(int position, View convertView, ViewGroup parent) n View view=View.inflate(mcontext, R.layout.saver_tickey_store_item, null);n //获取item对应的数据对象n GetDataType getdata=mData.get(position);n //初始化viewn ImageView iv_portrait= (ImageView) view.findViewById(R.id.IV_portrait);n TextView txt_name=(TextView) view.findViewById(R.id.txt_name);n TextView signature=(TextView) view.findViewById(R.id.signature);n //邦定数据到viewn iv_portrait.setImageResource(getdata.getIv_portrait());n txt_name.setText(getdata.getName());n signature.setText(getdata.getSignature()); n return view;n nnnnGetDataTypennpackage com.android.workapp;nnpublic class GetDataType n private int iv_portrait;n private String name;n private String signature;n public int getIv_portrait() n return iv_portrait;n n public void setIv_portrait(int iv_portrait) n this.iv_portrait = iv_portrait;n n public String getName() n return name;n n public void setName(String name) n this.name = name;n n public String getSignature() n return signature;n n public void setSignature(String signature) n this.signature = signature;n nn n![图片说明](https://img-ask.csdn.net/upload/201601/25/1453724110_137295.png)n
android 空指针错误求解
android 空指针错误rn今天运行代码的时候遇到了空指针错误,错误发生在:rnfindImageView(queue);rnqueue在前面有定义:rnint[] queue = R.drawable.p1, R.drawable.p2, R.drawable.p3, R.drawable.p4,rn R.drawable.p5, R.drawable.p6, R.drawable.p7, R.drawable.p8,rn R.drawable.p9, 1 ;rn还有一个空指针发生在:rnDrawable pic1 = getResources().getDrawable(queue[0]);rniv_1 = (ImageView) this.findViewById(R.id.ImageView01);rniv_1.setImageDrawable(pic1);rn上面的代码我单独的跑是没有问题的,可是在mainActivity中设置Intent,跳转到上面这个Activity后就发生了这样的错误,谁能解释一下?
Android studio中常用快捷键
记录一下在Android studio中用到的快捷键,随时更新。  ctrl+alt+v 自动添加返回值(条用一个方法或new一个对象时使用)  alt+insert 继承一个类或实现一个接口时 自动实现其方法  ctrl+alt+t  选中代码,按ctrl+alt+t添加try catch块或其他一些包含的块,如下图所示:        如果你已经习惯了eclipse的快捷键,也
android——studio中去除标题栏
在这里我有两种去除标题栏的方法来给大家分享 方法一 :在AndroidManifest.xml中 <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" andro
Android Studio中的快捷键
自动管理引用:Ctrl+Alt+O 显示一个方法的参数:Ctrl+P 将鼠标所在的行包围在一个结构中:Ctrl+Alt+T
Android studio中的标题栏
去掉标题,全屏展示
在Android Studio中测试代码
File=&gt;New Module=&gt;Java Library 添加main函数。 public class TestClass { public static void main(String[] args){ System.out.print("hello,world!"); } } 点击代码左侧的绿色三角形按钮运行程序。 ...
求助:空指针异常问题!急。
我建的是一个Web项目,在本机上测试没有异常!但发布Webservice之后,在另一个IP地址机上测试就rn报出了如下错误 :请问怎么解决!!!rnjava.lang.NullPointerExceptionrn at com.unitedpacs.impl.report.RisstudiesImpl.selectm(RisstudiesImpl.java:423)rn at com.unitedpacs.webservices.ReportWS.selectm(ReportWS.java:49)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at com.sun.xml.ws.api.server.InstanceResolver$1.invoke(InstanceResolver.java:246)rn at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:146)rn at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:257)rn at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:93)rn at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:598)rn at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:557)rn at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:542)rn at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:439)rn at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:243)rn at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:444)rn at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:244)rn at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:135)rn at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doGet(WSServletDelegate.java:129)rn at com.sun.xml.ws.transport.http.servlet.WSServletDelegate.doPost(WSServletDelegate.java:160)rn at com.sun.xml.ws.transport.http.servlet.WSServlet.doPost(WSServlet.java:75)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)rn at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)rn at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)rn at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)rn at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)rn at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)rn at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)rn at java.lang.Thread.run(Thread.java:619)rn
相关热词 c#串口测试应用程序 c# 匹配 正则表达式 c#防止窗体重绘 c#读写txt文件 c#挖地雷源代码 c#弹框选项 c# 移除 队列 c# 密码写入配置文件 c# 获取可用内存大小 c# 嵌入excel编辑