Android中调用startActivity结果导致:上网查了一下,总结如下:
第一种情况:java.lang.RuntimeException: Unable to start activity ComponentInfo{xxx}: java.lang.NullPointerException
错误代码:
private int defaultDrawable=R.drawable.radio;
private String defaultTitle=getString(R.string.defaulTitle);//这是第48行,也就是NullPointerException的地方
private String defaultInfo=getString(R.string.defaulInfo);
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.vlist2);
findViews();
setListeners();
}
private void findViews()
{
tvTitle=(TextView)findViewById(R.id.mainTitleText);
imgpre&#