hazem
hazem

Reputation: 505

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

    }
}

Upvotes: 1

Views: 292

Answers (1)

pankajagarwal
pankajagarwal

Reputation: 13582

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

Upvotes: 1

Related Questions