我有一个关于java-me列表的问题。我可以创建一个列表并将其添加到屏幕上,但我不能在屏幕底部添加任何菜单,比如“后退”。
我使用了以下代码:
String[] degerler = {"StringItem", "TextField", "DateField","ImageItem", "Gauge", "ChoiceGroup","List", "Alert", "Sounds"};
favlistelement = new List("Reservation type", List.IMPLICIT,degerler, null); 我用下面的代码把它添加到屏幕上:
disp.setCurrent(favlistelement ); 事实上,我有一个名为favoritesscreen,的表单变量,我想将列表添加到这个屏幕上,并带有像“后退”这样的菜单。
发布于 2012-11-14 22:39:15
我这样解决了我的问题。
backfavorites = new Command("Back",Command.BACK,0);
favlistelement = new List("Favorites:", List.IMPLICIT);
favlistelement.append("Incoming 1", null);
favlistelement.append("Incoming 2", null);
favlistelement.append("Incoming 3", null);
favlistelement.addCommand(backfavorites);
favlistelement.setCommandListener(this);我试图将监听器和命令添加到我的表单变量中,但是我试图将它们添加到列表元素变量中,这样问题就解决了。
要在屏幕中显示,请执行以下操作:
disp.setCurrent(favlistelement);https://stackoverflow.com/questions/13379711
复制相似问题