SHARE
TWEET

Untitled

a guest Jun 25th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Override
  2.     public boolean onKeyDown(int keyCode, KeyEvent event)
  3.     {
  4.         super.onKeyDown(keyCode, event);
  5.         switch(keyCode)
  6.         {
  7.         case KeyEvent.KEYCODE_HOME:
  8.             mHomeCheckbox.setChecked(true);
  9.             ButtonsList[3] = 1;
  10.             return true;
  11.         }
  12.         return false;
  13.     }
  14.      
  15. public boolean isApplicationSentToBackground(final Context context)
  16.     {
  17.         ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
  18.         List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
  19.         if (!tasks.isEmpty())
  20.         {
  21.             mHomeCheckbox.setChecked(true);
  22.             ButtonsList[3] = 1;
  23.             return true;
  24.         }
  25.         return false;
  26.     }
  27.  
  28.     @Override
  29.     protected void onPause()
  30.     {
  31.         if (isApplicationSentToBackground(this))
  32.         {
  33.         }
  34.         super.onPause();
  35.     }
  36.  
  37.     @Override
  38.     protected void onStop()
  39.     {
  40.         if (isApplicationSentToBackground(this))
  41.         {
  42.         }
  43.         super.onStop();
  44.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top