Reputation: 1219
I am noob in Android. Suppose I have two Activity
in my android app.
Activity
A and B, currently I am on Activity A then on click on one button I am now Activity B
. Here From Activity B I want to update some view with updated data that is in Activity A. I got updated data in Activity B so Should I use here LocalBroadCastReceiver
for this or anything ?? so that When I press back then app should show me updated data in Activity A
Should we use our custom callback here to update the UI view data of Activity A from Activity B ??
Upvotes: 0
Views: 153
Reputation: 3104
okay , there are multiple ways to do it :-
I dont think broadcastreceiver fits right in your scenario !!
Upvotes: 1
Reputation: 11234
No, you shouldn't use BroadcastReceiver
for that. The method depends on the size of data you want to transfer from Activity B
to Activity A
. If it's quite small, you can start Activity B
with startActivityForResult and then get data back at the onActivityResult method (in Activity B
you should use setResult once you are done). If the size of data is quite big, it's better to use DB
for storing it instead of keeping it in memory.
Upvotes: 2