1- my first activity (main) 2- this is my second activity 3 - this is my third action.
I want to run 2 of 1, and then form 2 to run 3, and then from 3 I take the data and return it to 1. I hope you guys understand.
Here is my code:
Running 2 forms of 1 liek is:
Intent intent = new Intent(getApplicationContext(),MessageBox.class);
intent.setFlags(Intent.FLAG_ACTIVITY_FORWARD_RESULT);
startActivityForResult(intent,5);
And then do 3 of 2, like this:
Intent intent = new Intent(getApplicationContext(),ImageReceiver.class);
startActivityForResult(intent,5);
And then in 3 I have something like this:
setResult(10);
finish();
So, I set the result, so in 2, to get this result, I:
if(requestCode==5)
{
if(resultCode==10)
{
Intent intent = new Intent(getApplicationContext(),MainActivity.class);
setResult(5,intent);
finish();
}
}
And then at 1 I got:
if(requestCode==5)
{
if(resultCode==5)
{
//here i am taking data from 3
}
}
The problem is that I cannot open 2 coz in logcat, I get:
04-23 22: 13: 15.579: E / AndroidRuntime (15313): android.util.AndroidRuntimeException: FORWARD_RESULT_FLAG is used, also requesting the result
And I really don’t understand what to do. Take a look at this code.