Reputation: 4968
in my app in activity A i have a list view showing some details along with an image at the bottom and a button at the top. When the user clicks in the list it opens a new activity B.
If the user clicks the back button he returns back to activity A and there i want to show a new Image in the image View. At the same time there should not be any change in the activity A.
In iPhone we are to use a method called View will appear.
like that is there any method in android. How to do this, please help me friends.....
Upvotes: 0
Views: 400
Reputation: 53667
Instead of using startActivity
to start an activity use startActivityForResult
.
If you are in Activity A onitemclick event
use the following code to start activity B
Intent intent = new Intent(WebViewTest.this,
B.class);
startActivityForResult(intent, 500);
write the image updation code inside following method so that when activity B is finished the control comes to the following method. You can use Handler concept also to update image
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
// TODO Auto-generated method stub
super.onActivityResult(requestCode, resultCode, data);
System.out.println(requestCode + "...called from another activity..."
+ resultCode);
if (requestCode == 500) {
//upate image
}
}
Thanks Deepak
Upvotes: 1