1

I have 3 activities. Activity A is parent Activity, Activity B is started as Child Activity of Activity A. Now when I called StartActivityForResult from Activity B for Activity C, Only Activity A's onActivityresult is called. I want to get Results in Activity B's OnActivityResult.

Intent it = new Intent(B.this, C.class);
getParent().startActivityForResult(it, REQUEST_CODE);

If i call like this.

startActivityForResult(it, REQUEST_CODE);

Both onActivityResult didn't called.

Any help will be Appreciated.

vjdhama
  • 4,878
  • 5
  • 33
  • 47
user3441778
  • 183
  • 1
  • 10

2 Answers2

1

Thanks For the help. I solved my Problem. That was due to ActivityGroup. I use these methods.

Intent it = new Intent(B.this, C.class);
getParent().startActivityForResult(it, REQUEST_CODE);

This will gives you the result in Activity A's OnActivityResult. Yo need to call this from Activity A's result.

if (requestCode == 1) {     
            ActivityB activity = (ActivityB)getLocalActivityManager().getCurrentActivity();
            activity.onActivityResult(requestCode, resultCode, intent);
        }

this will invoke Activity B's onActivityResult.

user3441778
  • 183
  • 1
  • 10
0

Just call activity C from B using below line of code.

Intent it = new Intent(B.this, C.class);
startActivityForResult(it, REQUEST_CODE);

And you will get your result back on your "B" activities onActivityResult();

Shayan Pourvatan
  • 11,898
  • 4
  • 42
  • 63
Ashok Singhal
  • 520
  • 1
  • 5
  • 10