首页 \ 问答 \ 怎么在eclipse上配置android开发环境

怎么在eclipse上配置android开发环境

更新时间:2022-01-01 22:01

最满意答案

哪一行报这个错误
然后看一下这行用到了那几个变量
这几个变量中又没有对象型、String型、boolean型变量
如果有,那么这几类的变量有没有进行初始化
对象型用Object o=new Object()
String型用String s=""
boolean型用boolean b=true或者boolean b=false
或者考虑对这些变量进行赋值操作的代码部分有无可能使变量值为null

最好能把代码贴上来看看

其他回答

nullpointerexception是空指针异常。是java运行时异常,必须要程序员来处理的。简单来说就是你的程序有bug。出现这个错误的根本原因就是你在程序中调用了一个空对象的属性或者方法。原因一般有两个:1。对象没有实例化,就是没有new xxx();2。对象实例化过了,但是在程序的某个地方又被赋予了null值。打个断点调试一下就知道了。
NullPointerException空指针异常,你要检查下你的程序,可能是数组长度超出,等等。
可以用try{}catch(Exception e){}来处理这个异常。

相关问答

更多
  • 哪一行报这个错误 然后看一下这行用到了那几个变量 这几个变量中又没有对象型、String型、boolean型变量 如果有,那么这几类的变量有没有进行初始化 对象型用Object o=new Object() String型用String s="" boolean型用boolean b=true或者boolean b=false 或者考虑对这些变量进行赋值操作的代码部分有无可能使变量值为null 最好能把代码贴上来看看
  • // 举个例子 public static void throwNullException() { String str = null; try { if (str.equals("test")) { System.out.println("正常"); } } catch (NullPointerException e){ // print str System.out.println(str); // Or write str into log file // Or write content of [e ...
  • ImageButtons现在都为null ,因为尚未设置正确的内容视图。 您需要在onFinish()方法中设置OnClickListener 。 所以你的代码是: public class MainActivity extends Activity { private ImageButton car; private ImageButton foot; private ImageButton bus; private ImageButton train; p ...
  • 这条线 input = new BufferedReader(new FileReader("readfile.txt")); 可能会在output初始化之前抛出。 因此在尝试执行output.close();时output == null output.close(); 。 也许你的意思是这样的: if (output != null) output.close(); The line input = new BufferedReader(new FileReader("readfile.t ...
  • 你从未真正创建过ArrayList。 你需要 private ArrayList huutokaupat = new ArrayList(); You never actually created the ArrayList. You need private ArrayList huutokaupat = new ArrayList();
  • static Printer obj =null; private Printer(){} public static Printer getInstance(){ if(obj==null){ Printer pr=new Printer(); } return obj; } 您创建一个新的Printer对象,但返回null值。 正确: static Printer obj = null; priva ...
  • 你需要初始化价格表。 prices = new ArrayList(); you need to initialize the prices list. prices = new ArrayList();
  • 你永远不会在你的mainMethod类中初始化你的animals数组。 在你的public mainMethod()方法中,你需要animals = new animalsData[INITIAL SIZE]; 如果你想让它自动增长,你应该使用一个List 。 即使那样你也不会使用this.animals.length + 1作为索引。 你只需要做List.add() You are never initializing your animals array in your mainMethod class ...
  • 我用jmeter问题跟踪器记录了这个bug。 他们建议使用这两个文件更改重新编译源代码的解决方案。 jmeter / trunk / src / protocol / http / org / apache / jmeter / protocol / http / proxy / Proxy.java jmeter / trunk / xdocs / changes.xml 实际错误https://bz.apache.org/bugzilla/show_bug.cgi?id=58453 谢谢, I logg ...
  • 删除stat实例变量。 删除con实例变量。 删除sql实例变量。 它们都应该是局部变量(这可能是您的异常的原因:您正在关闭stat而不是关闭preparedStatement 。堆栈跟踪中的行号应该确认它)。 另外,确保它们在最后一个块中关闭,以确保它们已关闭。 请注意:如果关闭预准备语句会引发异常,则不会关闭连接。 Remove the stat instance variable. Remove the con instance variable. Remove the sql instance va ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。