SOBs suggestion is a good one !  

Due to security,  Android prevents injecting keypad events, so while you may 
have found an event it most likely will not be callable or will be neutered.
 I tinkered with this trying to map up-down key events to perform an auto 
highlight f(x) in ListViews with GoogleTV.  While I did get it to work it was 
painfully time consuming.
 
  ----- Original Message ----- 
  From: Streets Of Boston 
  To: [email protected] 
  Sent: Monday, October 22, 2012 10:44 AM
  Subject: [android-discuss] Re: onStop() and onBackPressed()


  No you shouldn't. The method onBackPressed is called for you by the OS.


  If you want to destroy (i.e. finish()) your activity when the device goes 
asleep, register a broadcast receiver in your Java code that listens to the 
Intent.ACTION_SCREEN_OFF broadcast. When this broadcast is received 'finish' 
your activity.

  On Monday, October 22, 2012 9:51:29 AM UTC-4, Saksham Chand wrote:
    Hi,

    I am writing an application where if the device goes to suspend mode, the 
current activity should get destroyed, instead of being paused, and on wake-up, 
its parent activity should be displayed.

    Currently, what I've done is to call onBackPressed() from onStop() 
something like this:

    onStop()
    {
        doCleanup();
        if (!bBackPressed)   // Bool to teel if back button was pressed or not
            super.onBackPressed();
        super.onStop();
    }

    And in onSaveInstanceState() I'm doing nothing i.e. I'm not calling 
super.onSaveInstanceState().

    I want to ask if I can call onBackPressed from onStop???

    Thanks,
    Saksham



  -- 
  You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
  To view this discussion on the web visit 
https://groups.google.com/d/msg/android-discuss/-/xnhd_urU7q4J.
  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-discuss?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Android Discuss" 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-discuss?hl=en.

Reply via email to