按照书上讲的内容,我搭建好android的开发坏境。然后尝试了我的第一个程序,helloworld。
结果运行起来报错,java.lang.nullpointException.然后我到网上查了一下,很多人说是 userdata.img文件的问题,我删了之后发现,问题还是存在,没有解决。忘各位高手们帮帮忙!感激不尽!!!!

解决方案 »

  1.   

    package com.eoeAndroid.helloWorld;import android.app.Activity;
    import android.os.Bundle;
    import android.widget.TextView;public class HelloWorldActivity extends Activity {
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.main);
            TextView tv = new TextView(this);
            tv.setText("Hello World");
            setContentView(tv);
        }
    }就这段代码,我按照书上写的
      

  2.   

    看起来是路径问题,编译产生的class文件路径是什么?
      

  3.   

    恩,现在解决了!
    是我Android sdk路径里面存在空格,所以出现了错误
    现在改了之后,可以用了,谢谢!