Reputation: 299
Well my question may be a bit immature but I'm really wandering about it.
How can I access the layout of activity A from the class of activity B. i.e I want to change the image in xml
file of Activity A from activity B.
Is it possible? Kindly help.
Upvotes: 0
Views: 1102
Reputation: 715
You Can't modify A's Image at a running time becasuse A will be in pause mode when B is in front. You need to startActivityForResult();(A ----> B);
And in ActivityForResult()
method you need to right your Handler logic to change the Image.
In B activity finished you need to set the Result.
Upvotes: 0
Reputation: 11234
You don't need to do it in such a way. I suggest you to look at the startActivityForResult. Start Activity B
, do all the needed work there and once you are done, you'll be returned to the Activity A
and considering the data you get at the onActivityResult, you can change the image at the content view of Activity A
Upvotes: 1
Reputation: 133560
No you can't access views of one Activity in another. You can Navigate to another Activity and change the image there.
You set a layout for each Activity and Each Activity has a life cycle.
Upvotes: 0