1

I am trying to go back and forth from page A to B and vice versa without losing any info that has been updated. For example, lets say by default a pic on page B is a blank screen, but then the user updated it to something. Then if the user goes back to page A and then back to back B again, the pic for B should still be the pic that the user selected, not the default pic.

I have tried using onBackPressed() for page B, but I have no idea what to do for page A (or if onBackPressed even works they way I want it to). The reason for this is because when you click the button to go from A to B, I create a new intent. Thus, I will be losing all of the updates on page B. Is there like a "forward" feature or something so that I dont create a new Intent for any of em?

mr nooby noob
  • 1,860
  • 5
  • 33
  • 56
  • Do you want this image change to be available when the user returns to the app after a closing it? If so then make some kind of settings with SharedPreferences or maybe SQLite to save user preferences. – Rahul Thakur May 01 '15 at 01:58

1 Answers1

0

Make sure that you send a new intent back to A, but when creating your intent in A, test to make sure that an intent was not created in B, i.e.

if(myIntentFromB == null){//assume your starting point belongs in A, do stuff} else{//receive data from intent sent from B, do stuff with it in A, such as set the picture.}

Don Larynx
  • 685
  • 5
  • 15
  • I totally understand what you mean, I was using a counter for the first Intent, but how do I sent back the new Intent B to A? – mr nooby noob May 01 '15 at 00:56
  • Possibly related http://stackoverflow.com/questions/18243515/android-going-back-to-previous-activity-with-different-intent-value/18243541#18243541 – Don Larynx May 01 '15 at 12:51