Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @Override
  2. public boolean dispatchKeyEvent(KeyEvent e) {
  3. if (e.getKeyCode() == KeyEvent.KEYCODE_F) {
  4. Log.d("Test","YOU PRESSED THE F KEY");
  5. startActivity(new Intent(getApplicationContext(), Activity2.class));
  6. return true;
  7. }
  8. return super.dispatchKeyEvent(e);
  9. };
  10.  
  11. public abstract class BaseActivity extends Activity {
  12. @Override
  13. public boolean dispatchKeyEvent(KeyEvent e) {
  14. if (e.getKeyCode() == KeyEvent.KEYCODE_F) {
  15. Log.d("Test","YOU PRESSED THE F KEY");
  16. startActivity(new Intent(getApplicationContext(), Activity2.class));
  17. return true;
  18. }
  19. return super.dispatchKeyEvent(e);
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement