RuntimeException:无法启动活动ComponentInfo java.lang.NullPointerException

时间:2013-09-15 15:28:57

标签: java android class android-activity main

在我的Main课程中,我有这段代码:

public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);      

    Show s = new Show();    
}
}

在我的Show Class中,我有这个代码

public class Show extends Activity {
protected ListView showme = null;

public Show() {
    showme = (ListView) findViewById(R.id.mylw);        
}
}

当我执行此代码时,我收到此错误:

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.ahah/com.example.ahah.Main}: java.lang.NullPointerException

0 个答案:

没有答案