在我的应用程序中,底部有 4 个选项卡,每个选项卡都连接到一个 ActivityGroup:
tabHost.addTab(tabHost
.newTabSpec("Group1")
.setIndicator("group1")
.setContent(new Intent(this, Group1.class)));
group1 就像一个控制子Activity行为的接口
this.history = new ArrayList<View>();
group1 = this;
/** a frame for its child **/
View view = getLocalActivityManager().startActivity(
"Group1_Layer1",
new Intent(Group1.this, costumeList.class)
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK))
.getDecorView();
replaceView(view);
goup1 有一个自定义的 ListView:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
if (v == null) {
LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
v = vi.inflate(R.layout.xml, null);
ImageView image = (ImageView) v.findViewById(R.id.cell);
.
.
}
return v;
}
}
但它崩溃了,logCat 显示:
Unable to start activity, java.lang.NullPointerException
崩溃刚刚发生在自定义 ListViews 中,
其他活动没有这个问题,
它出什么问题了?