Skip to content Skip to sidebar Skip to footer

Startactivityforresult Doesn't Seem To Call Onactivityresult

When The user Click on the button it want to call the dialog- that dialog contain list of product in ListView.After user slect the product it should come to previuous activity. I h

Solution 1:

I have same issue when I was using startActivityForResult() with activity group.

your activity result will go to your activity group.You will not get activity result in your first activity

So you can solve this issue by taking one public static object in your first activity and when you call second activity you have to assign your first activity object from second activity.and then finish second activity so that your first activity will resume and you can update your ui by overriding onResume() method in first activity.You have to check validation weather your object is assigned or not.

For example

You have one static object product in your first activity

First Activity

publicstatic Product product;
start second activity
startactivity(this, SecondActivity.class);

don't finish First Activity

You have to override onResume() method and then you can use product object which is assigned by second activity

second activity

FirstActivity.product.setName(name);
FirstActivity.product.setPrice(price);

After assign the product object you have to finish second activity like

finish()

EDIT

I got the solution for your issue of badTokenException

Here is the solution

CLICK HERE

Post a Comment for "Startactivityforresult Doesn't Seem To Call Onactivityresult"