I would like to control arrow key events in android. I am testing the app in Samsung I5500 phone. The app consists of tabs. I was successful to capture the events using listeners.
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
Log.i(TAG_NAME, "key event: " + keyCode);
if(keyCode == KeyEvent.KEYCODE_DPAD_CENTER) {
Log.i(TAG_NAME, "Directional centre pad pressed");
}
}
For instance, an activity in the third tab contains a listview of 3 items
Item A
Item B
Item C
I navigate to third tab using right arrow and clicked down arrow to select one of the above items. Clicking DPAD_CENTER key triggers ItemClick listener attached to the listView. Everything is fine until now. However, after that, current tab focus is moved to home (tab 0). The adapter which tries to render UIfails to load since it is in a different tab. Eventually it crashes down.
Has anyone experienced this before? I searched in the internet. I didn't find anything worth enough.