How to call startActivityForResult from fragment's custom ArrayAdapter
<p>I have a fragment and inside there is a ListView.</p>

<p>In the ListView Item there are ImageButtons like Delete and Update</p>

<p>In the Adapter of ListView I have </p>

<pre><code>EditTeam.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v)
        {
            Intent intent=new Intent(getContext(),AddTeam.class);
            ((Activity)getContext()).startActivityForResult(intent, 2);

        }
    });
</code></pre>

<p>but its not returning to fragment's ActivityOnResult method</p>

<p>So I am guessing its the ((Activity)getContext()) part.. which needs to be something declaring the fragment? </p>

<p>the ActivityForResult method which is inside the fragment is the following:</p>

<pre><code>@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
    super.onActivityResult(requestCode, resultCode, data);

    if(requestCode==2)
    {
       Toast.makeText(getContext(),"NEW TEAM SAVED",Toast.LENGTH_LONG).show();
    }

}
</code></pre>

<p>How I can fix this</p>

<p>Thank you</p>