startActivityForResult extrange behavior
<p>I cannot see what is wrong in my code: </p>

<p>I have an activity (lets call it; A) that starts another activity (B) in this way:</p>

<p>In A:</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
        ...
    gridOpciones.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView&lt;?&gt; parent, View v, int pos, long 
            intent = new Intent(ReproductorActivity.this, B.class);
            startActivityForResult(intent, B.RESULT_PATH);
    }
}
</code></pre>

<p>I have in a OnLongItemClickListener asigned to B' listview with this onItemLongClick</p>

<pre><code>@Override
public boolean onItemLongClick(AdapterView&lt;?&gt; arg0, View arg1, int arg2,long arg3) {
    ctx.onLongClick(arg2);
    return false;
}
</code></pre>

<p>Being ctx the B object owner of the OnLongItemClickListener and onLongClick this method in class B:</p>

<pre><code>public void onLongClick(int arg2) {
    Intent returnIntent = new Intent();
    returnIntent.putExtra("PATH", getItem(arg2));
    setResult(Activity.RESULT_OK, returnIntent);
    finish();
}
</code></pre>

<p>And I also have a callback function in A like this:</p>

<pre><code>@Override
protected void onActivityResult(int requestCode, int resultCode, final Intent data){               
    if (requestCode == B.RESULT_PATH) {
        if (resultCode == RESULT_OK) {
        ... get data, do stuff....                   
        }
    }
}
</code></pre>

<p>So, my problem is that it didn't work. It shows B but does nothing when is back...</p>

<p>I've debug it and when I click the element of the grid in the the class A its OnItemClickListener's <code>onItemClick</code> is called but, after this, the A's <code>onActivityResult</code> is called and after of this it appears B activity. I longclick in a item of B and it does the <code>onLongClick(int)</code> but there's no callback in <code>A.onActivityResult</code>...</p>

<p>I dont know what happens, any idea? any clue?</p>

<p>Thanks.</p>

<p>Edit: When OnActivityResult is called, requestCode == B.RESULT_PATH</p>
