当前位置: 动力学知识库 > 问答 > 编程问答 >

android - Enter key listener is not working

问题描述:

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?

分享给朋友:
您可能感兴趣的文章:
随机阅读: