Android 音量键增大减小捕捉

Android 音量键增大减小捕捉:

@Override
 public boolean onKeyDown(
   int keyCode, KeyEvent event) {
  // TODO Auto-generated method stub

if (keyCode == KeyEvent.KEYCODE_VOLUME_UP) {

Intent i = new Intent(
     Intent.ACTION_MAIN);

i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

i.addCategory(Intent.CATEGORY_HOME);

startActivity(i);

return true;
  }

if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN) {

Toast.makeText(
     Bengkui.this,
     "弹出对话框", 1000)
     .show();
   Intent intent = new Intent(
     Bengkui.this,
     ShoujizhengrenActivity.class);
   startActivity(intent);

return true;
  }

else {
   return super.onKeyDown(
     keyCode, event);

}

}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/pxpzg.html