问题描述:

i am using Dpad key listener its working fine for up,right,left and down key but its not working for Dpad center or enter key here is my code.

public boolean onKeyDown(int keyCode, KeyEvent event) {

View v = getSaveView();

switch (keyCode) {

case KeyEvent.KEYCODE_DPAD_CENTER:

Toast.makeText(this, "its working", Toast.LENGTH_LONG).show();

//View c = getSaveView();

if(v.getId()==1){

Intent i =new Intent(HomeScreen.this,MainActivity.class);

startActivity(i);

}

break;

where is i am doing wrong?

相关阅读:
Top