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

发布于 2024-10-06 13:26:03 字数 183 浏览 1 评论 0原文

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

我正在使用 J2ME - MIDP 2.0 制作移动应用程序。在我的应用程序中,我使用 javax.microedition.lcdui.CustomItem 绘制表格。我还实现了 traverse 方法。但部分手机不支持穿越。在不支持遍历的手机上如何实现遍历过程?

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 does not support traversing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

秋凉 2024-10-13 13:26:03

我得到了问题的解决方案。

首先我们通过“javax.microedition.lcdui.CustomItem”类的“getInteractionModes()”方法判断设备是否支持遍历。由此判断设备是否支持遍历。

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

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文