application fails when more than one activity calls startActivityForResult
<p>I have 2 activities that call a third activity using startActivityForResult but after the third activity finishes the application fails before onActivityResult is called.  When I initially had only 1 activity calling it, it worked fine and if I use the debugger it works, which usually means something is uninitialized.  My code is as follows:</p>

<p>Activity A:</p>

<pre><code>button1.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setClass(ActivityA.this, AddActivity.class);
        startActivityForResult(intent, ADD_CATEGORY);
    }
});

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == ADD_CATEGORY &amp;&amp; resultCode == RESULT_OK) {
        if (data.getCharSequenceExtra("Added") != null) {
            String category = data.getCharSequenceExtra("Added").toString();
            categoryList.add(category);
        }
    }
}
</code></pre>

<p>Activity B:</p>

<pre><code>button.setOnClickListener(new View.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent();
        intent.setClass(ActivityB.this, AddActivity.class);
        startActivityForResult(intent, ADD_ITEM);
    }
});

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);       
    if (requestCode == ADD_ITEM &amp;&amp; resultCode == RESULT_OK) {
        String item = data.getCharSequenceExtra("Added").toString();
        if (currentList == null) {
            currentList = new ArrayList&lt;String&gt;();
        }
        currentList.add(item);
        Collections.sort(currentList);
    }
}
</code></pre>

<p>Activity C:</p>

<pre><code>public class AddActivity extends Activity {

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.add);
        final EditText edittext = (EditText) findViewById(R.id.edittext);
        edittext.setOnKeyListener(new OnKeyListener() {
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                  // If the event is a key-down event on the "enter" button
                  if ((event.getAction() == KeyEvent.ACTION_DOWN) &amp;&amp; (keyCode ==       KeyEvent.KEYCODE_ENTER)) {
                      // Return added item to the calling activity
                      Intent intent = new Intent();
                      CharSequence text = edittext.getText();
                      intent.putExtra("Added", text);
                      setResult(RESULT_OK, intent);
                      finish();
                      return true;
                  }
                  return false;
            }
        });
    }
}
</code></pre>

<p>Am I missing something or could this be an Android bug?</p>
