Hey there- Look into maintaining application state by subclassing Application. An instance of your application class will be created when your application is started. From any activity you can call getApplication() to get this instance.
Try storing relevant info to the current song as variables within your application class. In onResume() check for current song data in your application instance and when you end a song or start a new one update your stored data accordingly. Hope this helps. Nick On Mar 11, 10:28 pm, Prajakta Shitole <[email protected]> wrote: > Hi, > > Thanks for your reply. > > Well What I do is: > > I call A, then from A I call B. > A -> B > Then press the backbutton and go to A > I dont perform any operations in A, and I want to get back to the same > activity B which I had previously called. > > A and B was just an example. I am actually creating a media player app. So > one of my activity has a song playing page which has a service bound to it. > So if the user navigates to any other activities in the app i want to get > back to the song playing page which he was listening to. > I have created a service which plays the music in background . so from any > other activity if a song is being played i enable a menu button (by checking > the services that are currently running in the app). And on click from any > other activity I want to navigate to the song playing page which has a > picture and a text view. > > One of my idea was to store the picture and the text view in the service and > on click of a menu button navigate to another activity which will connect to > the service and draw the stored pictures, text views in its activity. But I > was not sure if that would have been the right approach so was thinking on > the lines of saving the state of the activity and getting back to it on the > menu button click. > Thus I wanted to use OnPause. I am not very clear on this, so please can you > let me know. > > Thanks, > Prajakta > > > > On Thu, Mar 11, 2010 at 10:13 PM, TreKing <[email protected]> wrote: > > On Thu, Mar 11, 2010 at 10:51 PM, praj <[email protected]> wrote: > > >> I have an application where I navigate from Activity A to Activity B and > >> back to A and then B. > > > Are you saying you open A then open B, press the back button to return to A > > then do whatever it is you did the first time to get back to B? If so B will > > be re-created with a brand new Intent which will contain whatever you > > stuffed in there. > > >> I want to resume the activity B (which has a Bundle passed to it ) from > >> Activity A. > > > What do you mean you want to "resume" B? If you've gone to B and pressed > > back to get back to A, B is gone. It will recreated, not resumed. > > >> The documentation says that OnSaveInstance() is called only when the > >> activity is killed, > > > Not just that it's killed - when it's killed by the system and may > > potentially need to be restored - like the user pressed the Home key. If you > > press back or intentionally finish the activit, onSaveInstanceState is not > > called. > > >> so how do i use OnPause which does not have the Bundle to resume the > >> activity B. > > > You don't. > > > If you're trying to do what I think you're trying to do you might: > > In A, start B with startActivityForResult(). > > In B, when pausing call setResult() with state information for B. > > In A, onActivityResult() get the result Intent and save it for later. > > When restarting B if you have the previous state information for B, pass > > that in to the Intent for B. > > In B onCreate get the Intent and get the state information from it, if it > > exists. > > > Hope that helps. Good luck. > > > --------------------------------------------------------------------------- > > ---------------------- > > TreKing - Chicago transit tracking app for Android-powered devices > >http://sites.google.com/site/rezmobileapps/treking > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected]<android-developers%2Bunsubs > > [email protected]> > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

