通知数据集更改();未找到源异常
我在 windows 7 64bit 下使用 android 1.6 当我从扩展 BaseAdapter 的适配器对象调用 notificationDataSetChanged() 时,我得到了运行时异常
,我尝试使用 Eclipse 调试器并发现主要活动尝试调用此方法 ZygoteInit$MethodAndArgsCaller.run() line: 842 但当它调用时就出现了异常,找不到Source。
所以如果有什么关系我会很感激
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);
}
});
}
}
I'm using android 1.6 under windows 7 64bit
when I call notifyDataSetChanged() from the adapter object which extends BaseAdapter I got runtime exception
I tried to use the Eclipse debugger and figured out that the main activity tries to call this method ZygoteInit$MethodAndArgsCaller.run() line: 842 but when it calls it , an exception appears Source not found.
so if there is anything to do with I'd be thankful
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);
}
});
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仔细查看日志。它在 Task.java 的第 25 行中命中了一个空指针。检查您的代码或将其发布到此处
see the log carefully. It hits a null pointer in the in line number 25 in Task.java. Check your code or post it here