You can use this to transfer active objects across activity instances when a configuration change is happening:
http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance() On Fri, Dec 31, 2010 at 2:24 AM, mani <smanikanda...@gmail.com> wrote: > I am confused between screen rotation and activity sent back. > > My requirement i am trying out in my application is > > - when activity goes to idle( meant pressing back ) , i need to stop a > timer. > - When screen rotation happens i shouldnt stop a timer. > > I also registered for action_configuration_changed to know when the > screen rotation happens. > > IntentFilter filter = new IntentFilter(); > filter.addAction(Intent.ACTION_CONFIGURATION_CHANGED); > mContext.registerReceiver(mBroadcastReceiver, filter); > > private BroadcastReceiver mBroadcastReceiver = new BroadcastReceiver() > { > public void onReceive(Context context, Intent intent) { > String action = intent.getAction(); > if (Intent.ACTION_CONFIGURATION_CHANGED.equals(action)) { > //updateBackground(); > screeChanged = true; > System.out.println("On screen changed"); > } > } > }; > > > When i traced the flow, when back happens this is wat i observed. > > Screen rotated from landscape to portrait > > I/System.out( 1666): On stop > I/System.out( 1666): On Destroy > I/System.out( 1666): On create > I/System.out( 1666): On resume > I/System.out( 1666): On screen changed > > Screen rotated from portrait to landscape > > I/System.out( 1666): On pause > I/System.out( 1666): On stop > I/System.out( 1666): On Destroy > I/System.out( 1666): On create > I/System.out( 1666): On resume > I/System.out( 1666): On screen changed > > When back pressed: > ---------------------------------- > I/System.out( 1666): On pause > I/System.out( 1666): On stop > I/System.out( 1666): On Destroy > > > All these function calls are similar for both usecase... so any clue > how do i differentiate my activity is went back or screen changed. > > Could somebody throw lights on my problem. > > Thanks, > Mani > > -- > 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<android-developers%2bunsubscr...@googlegroups.com> > For more options, visit this group at > http://groups.google.com/group/android-developers?hl=en > -- Dianne Hackborn Android framework engineer hack...@android.com Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails. All such questions should be posted on public forums, where I and others can see and answer them. -- 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