开发者

How to handle traversing in CustomItem of J2ME in a mobile phone which does not support traversing?

How to handle traversing in CustomItem of J2ME in a mobile phone which does not support traversing?

I am doing a mobile application using J2ME - MIDP 2.0. In my application I draw the table using javax.microedition.lcdui.CustomItem. I also implement the traverse method. But in some mobile phones the traversing is not supported. How to implemnent the traversing process in a mobile which开发者_如何学Go does not support traversing?


I got the solution for the problem.

First we find the device does support traversing or not by the method "getInteractionModes()" of the class "javax.microedition.lcdui.CustomItem".From that we get the traversing support or not.

If traversing is not support means then add a Command button for that then implement the traversing operation inside the button click event handling ( public void commandAction(Command c, Item item) ).

finding the device support traversing or not is shown in the following coding snippet

int supported_interaction_modes=this.getInteractionModes();
boolean horizontal_interaction,vertical_interaction;

if((supported_interaction_modes&CustomItem.TRAVERSE_HORIZONTAL)!=0)
  horizontal_interaction=true;
else
  horizontal_interaction=false;

if((supported_interaction_modes&CustomItem.TRAVERSE_VERTICAL)!=0)
  vertical_interaction=true;
else
  vertical_interaction=false;

In the above coding snippet "this" refers to the child class of CustomItem (javax.microedition.lcdui.CustomItem) which is user-defined class for CustomItem operations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜