Reputation: 2244
I have a problem about java-me list. I can create a list and add it to screen but I couldn't add any menu bottom of the screen like 'Back'.
I used this code:
String[] degerler = {"StringItem", "TextField", "DateField","ImageItem", "Gauge", "ChoiceGroup","List", "Alert", "Sounds"};
favlistelement = new List("Reservation type", List.IMPLICIT,degerler, null);
and I added it to screen with this code:
disp.setCurrent(favlistelement );
In fact I have a form variable called favoritesscreen,
I want to add the list to this screen with menu like 'Back'.
Upvotes: 1
Views: 806
Reputation: 2244
I solved my problem in this way
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);
I was trying to add listeners, command to my Form variable but I tried to add these to my list element variable thus it was solved.
To show in screen:
disp.setCurrent(favlistelement);
Upvotes: 1