Friday, June 11, 2010

Handle KeyPress Event in List

Let's take a scenario, where we provide the feature for user to select an option from the given list of options and press RIGHT key in the mobile to select that option. To implement this scenario in J2ME, we don't have other options but to use Canvas Class to track which key is pressed by the user.

However, we can implement this feature in J2MEPolish easily. For that we need to use the class de.enough.polish.ui.List and override the method " public void keyPressed(int keyCode)" in the List. However don't forget to override this method by "super.keyPressed(code)".

:-))

Loving J2MEPolish !! ;-)