开发者

notifyDataSetChanged(); source not found exception

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);
            }
        });

    }
}


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜