tags:

views:

91

answers:

1

Hi, I am working on a J2ME app which has dynamically generated Lists. Items on this list may be consequently selected, and the selection processed within the commandAction block.

Is there a way to have the IDs of variables populating the List (from a remote database) included in the List item definition as in:

this.append("A", null);
this.append("B", null);

or:

String[] arrayOfValues = {"A", "B"};
new List("Menu", List.IMPLICIT, arrayOfValues, null);

such that when an item is selected, perhaps A, I can also have its database ID for perhaps further processing. Is it possible to hide a field/data? Thanks.

A: 

You can extend List

Add an void append(MyNewClass) method to your extended List class.

MyNewClass contains both the String you will append to the List and your database ID

Keep an additional container in your extended List class and make sure that List.getSelectedIndex() allows you to find the correct MyNewClass object in the container.

QuickRecipesOnSymbianOS