1

I have a Gallery of dates that show up when I click on one of the tabs in my TabActivity. When I click on a date in the Gallery, it centers as it should. However, if I scroll through the other days, say about a month ahead (you can only see a few dates at a time), and click on a date, and then leave the tab I am on and then come back, the day I just clicked on in my gallery is no long showing. My gallery ends up going back to the beginning and I have to scroll through to find the date in the future I just clicked on (it's highlighted). Is there a way to fix this?

Thanks.

Swifty McSwifterton
  • 2,637
  • 1
  • 30
  • 37

1 Answers1

0

In most cases, when you leave an app you need to save it's current state. Depending on what goes on in the background of your phone crazy things can happen to your app. The best way to do this, is to save the state (the page you're on and what is selected) in your onPause method, and check for saved state data to alter the view with in onResume.

Here is a graphical example of the application life cycle:

http://developer.android.com/images/activity_lifecycle.png

I'll refer you to the following previously asked question for more information:

Saving Android Activity state using Save Instance State

Community
  • 1
  • 1
CuddleBunny
  • 1,941
  • 2
  • 23
  • 45