onActivityResult works for first only problem
<p>hi all
i am trying to get values from second activity in first(main) activity. for that i use onActivityResult in firstactivity. it return value to first(main) activity from second activity first time only. again i am come to firstactivity the previous value only shown.</p>

<p>my application flow:</p>

<p>first->second->first</p>

<p>first(main)activity:</p>

<pre><code>   public class main extends Activity {
    /** Called when the activity is first created. */
    LinearLayout l2;
    TextView tv2;
    String check=null;
//    static int value=0;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        l2 = (LinearLayout)findViewById(R.id.linearLayout2);
        tv2=(TextView)findViewById(R.id.textView2);


    l2.setClickable(true);

    l2.setOnClickListener(new View.OnClickListener() 
    {
        public void onClick(View view) 
        {
            Intent myIntent = new Intent(view.getContext(), secondactivity.class);
             startActivityForResult(myIntent, 0);
        }

    });

}

@Override
public void onActivityResult(int reqCode, int resCode, Intent data)
{
    Log.e("runapp1","onActivityResult");
    Bundle bundle = data.getExtras();
    check = bundle != null ? bundle.getString("key1") : "";
    Log.e("runapp1","onActivityResult value  "+check);
    tv2.setText(check);
}    
}
</code></pre>

<p>in second activity:</p>

<pre><code>public class secondactivity extends Activity {
    /** Called when the activity is first created. */
    CheckBox c1,c2;
    TextView t;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.secondactivity);
        c1=(CheckBox)findViewById(R.id.checkBox1);
        c2=(CheckBox)findViewById(R.id.checkBox2);

    c1.setOnClickListener(new View.OnClickListener() 
    {
        public void onClick(View view) 
        {
            c1.setChecked(true); 
            Bundle bundle = new Bundle();
            bundle.putString("key1",String.valueOf(c1.getText()));
            Intent myIntent = new Intent(view.getContext(), main.class);
            myIntent.putExtras(bundle);
            setResult(RESULT_OK, myIntent);
            finish();

        }

    });
    c2.setOnClickListener(new View.OnClickListener() 
    {
        public void onClick(View view) 
        {
            c2.setChecked(true); 
            Bundle bundle = new Bundle();
            bundle.putString("key1",String.valueOf(c1.getText()));
            Intent myIntent = new Intent(view.getContext(), main.class);
            myIntent.putExtras(bundle);
            setResult(RESULT_OK, myIntent);
            finish();               
        }

    });

}
}
</code></pre>

<p>please assist me.</p>
