1

This app was working, and now it isn't, and I can't see why. The exception happens on

setContentView(R.layout.activity_todo);

I looked at all the other answers to similar questions that I could find, and none of them solved my problem.

Here's the main activity:

public class TodoActivity extends Activity  {

    ...

    lvItems.setOnItemClickListener(new OnItemClickListener() {
    @Override
    public void onItemClick(AdapterView<?> parent, View view,
            int position, long rowId) {
        Intent i = new Intent(TodoActivity.this, EditItemActivity.class);
        i.putExtra(EDIT_ITEM_NAME,items.get(position));
        i.putExtra(EDIT_ITEM_POSITION, position);

        // pass the due date as a long 
        Calendar c = Calendar.getInstance();
        Date d = c.getTime();
        i.putExtra(DUE_DATE, d.getTime() );
        startActivityForResult(i, REQUEST_CODE);

        return;
    }

Here's the EditItemActivity:

public class EditItemActivity extends FragmentActivity 
{

    ...

    protected void onCreate(Bundle savedInstanceState) {
        String itemName;
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_edit_item);

        ...

I changed it to extend FragmentActivity so I could start a Fragment after a checkbox is clicked. But I changed it back to Activity as a test, and it still crashes.

Can anyone please tell me what's going on? And how to fix it?

Andrew T.
  • 4,701
  • 8
  • 43
  • 62

0 Answers0