Thx Murphy.

I try to fix it by like this:

boolean activityActive = true;

protected void onResume() {
    // do something
    activityActive = true;
}

protected void onPause() {
   // do something
   activityActive = false;
}

public boolean onKeyUp(int keyCode, KeyEvent event)  {
   if (!activityActive) {
      return false;
  }
  // do something
}

public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (!activityActive) {
      return false;
  }
  // do something
}

-- 
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

Reply via email to