I've three activities, A,B and C.
update
Seems like some people misunderstood, so just wanna clarify a couple things.
Seems like you're overcomplicating it.
When you purchase a product in Activity C, you should store the data on Firebase database. When you go back to Activity A you should obtain the list of purchased items from firebase and display them.
You cannot call methods of Activity A from Activity C. So don't be scared of obtaining data from Firebase every single time you open the activity, in the onCreate() method.
You can make a searchList and Add those search or selected items in searchList in Activity A and share that list with Activity B via parcelable Array List in intent. From Activity A share your list by this,
ArrayList<Object> object = new ArrayList<Object>();
Intent intent = new Intent(Current.class, Transfer.class);
Bundle args = new Bundle();
args.putSerializable("ARRAYLIST",(Serializable)object);
intent.putExtra("BUNDLE",args);
startActivity(intent);
and get that list in Activity B like this,
Intent intent = getIntent();
Bundle args = intent.getBundleExtra("BUNDLE");
ArrayList<Object> object = (ArrayList<Object>)args.getSerializable("ARRAYLIST");
if you want to share that same list to Activity C then share that list again like we do in Activity A and get that list via bundle like Activity B.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.