Marcin, I know activity life cycle but i am saving data at application level. Even if my activity has been destroyed, i dont want to loss data. Till the time my application is running, I want to keep that data but as soon as my application goes in background because of the home key, i want to clear data. because once my application is in background and user doesnt re start it, it will be wastage of memory.
On Feb 15, 3:57 pm, Marcin Orlowski <webnet.andr...@gmail.com> wrote: > > I am storing some data at application level, I want to clear it so > > that it doesn't consume memory when my application is in background. > > At the same time, i wish that this data shouldn't get earsed if my > > application has gone in the background because of an incoming call. > > > Do I need to capture key event in every activity? Is it possible to > > handle it at application level, so that i dont have to handle it in > > every activity and rewrite the same code. > > I'd suggest you read on Activity life cycle and write your resource saving > code in the right methods, so you get your goal without dirtry > trickery.http://developer.android.com/reference/android/app/Activity.html -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en