Java me 如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?

Java me 如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历?,java-me,midp,lcdui,traversal,Java Me,Midp,Lcdui,Traversal,如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历 我正在使用J2ME-MIDP2.0开发一个移动应用程序。在我的应用程序中,我使用javax.microedition.lcdui.CustomItem绘制表格。我还实现了遍历方法。但在一些移动电话中,不支持遍历。如何在不支持遍历的移动设备中实现遍历过程?我找到了问题的解决方案 首先,我们通过类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”找到设备是否

如何在不支持遍历的手机中处理J2ME的CustomItem中的遍历


我正在使用J2ME-MIDP2.0开发一个移动应用程序。在我的应用程序中,我使用
javax.microedition.lcdui.CustomItem
绘制表格。我还实现了
遍历
方法。但在一些移动电话中,不支持遍历。如何在不支持遍历的移动设备中实现遍历过程?

我找到了问题的解决方案

首先,我们通过类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”找到设备是否支持遍历,从中我们得到了遍历支持

如果遍历不支持,则为其添加一个命令按钮,然后在按钮单击事件处理(publicvoidcommandaction(Command c,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;

在上面的代码片段中,“this”指的是CustomItem的子类(javax.microedition.lcdui.CustomItem),它是用于CustomItem操作的用户定义类。

我找到了问题的解决方案

首先,我们通过类“javax.microedition.lcdui.CustomItem”的方法“getInteractionModes()”找到设备是否支持遍历,从中我们得到了遍历支持

如果遍历不支持,则为其添加一个命令按钮,然后在按钮单击事件处理(publicvoidcommandaction(Command c,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;
在上面的代码片段中,“this”指的是CustomItem的子类(javax.microedition.lcdui.CustomItem),它是用于CustomItem操作的用户定义类