我在windows 7 64bit下使用android 1.6 当我从扩展BaseAdapter的适配器对象调用notifyDataSetChanged()时,我得到了运行时异常
我尝试使用Eclipse调试器并发现主要活动试图调用此方法ZygoteInit $ MethodAndArgsCaller.run()行:842但是当它调用它时,会出现异常Source not found。
所以,如果有任何关系,我会感激不尽
and here is the code
public class ViewTaskActivity extends ListActivity
{
private Button addButton;
private TaskManagerApplication app;
private TaskListadapter adapter;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setUpViews();
app =(TaskManagerApplication)getApplication();
adapter = new TaskListadapter(app.getCurrentTasks(),this);
setListAdapter(adapter);
}
@Override
protected void onResume() {
super.onResume();
adapter.notifyDataSetChanged();;
}
private void setUpViews() {
addButton = (Button)findViewById(R.id.add_button);
addButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(ViewTaskActivity.this , AddTaskActivity2.class);
startActivity(intent);
}
});
}
}
答案 0 :(得分:1)
仔细查看日志。它命中Task.java中第25行的空指针。检查您的代码或在此处发布