如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?
我在做一个使用J2ME - MIDP 2.0的移动应用程序。在我的应用程序中,我使用javax.microedition.lcdui.CustomItem
绘制表格。我也执行traverse
方法。但在一些手机中,不支持遍历。如何在不支持遍历的移动设备中实现遍历过程?
如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?
我在做一个使用J2ME - MIDP 2.0的移动应用程序。在我的应用程序中,我使用javax.microedition.lcdui.CustomItem
绘制表格。我也执行traverse
方法。但在一些手机中,不支持遍历。如何在不支持遍历的移动设备中实现遍历过程?
我得到了问题的解决方案。
首先,我们发现设备不支持遍历或不通过类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”。从中我们获得遍历支持与否。
如果遍历不是支持的意思,那么为其添加一个Command按钮,然后在按钮单击事件处理(public void commandAction(Command c,Item item))中实现遍历操作。
找到设备支持横动或不能在以下编码片断
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;
在上述编码代码段中所示的“本”是指在子类的CustomItem(javax.microedition.lcdui.CustomItem)的其是CustomItem操作的用户定义类。