在我的主要课程中,我有以下代码:
public class Main extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Show s = new Show();
}
}
在我的表演课上,我有这个代码
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