I have an activity A .It can launch itself many times with data requested from the server or call activity B(like A ->A ->B ->A).If the most recent and currently in foreground, activity A make some edits(delete or update operation)to the data, I want the previous instances of A to reload the data in them.How can I achieve this? I don't want to use startactivityforresult again and again as it will complicate the workflow.Can this be done using broadcast receivers or services? How?
You can use EventBus to achieve this. Simply register each activity in onStart()
, and unregister in onDestroy()
, and when the data comes to whichever activity, simply call EventBus.getDefault().post(YourDataClass data);
and each activity will receive the data.