How to get the selected combo box item

I am using lwuit with j2me. How to get a combo box of a selected item or index? I found a function for setSelectedIndex , but not for selection.

+6
source share
2 answers

Use this code:

combobox.getSelectedIndex(); 

To return the currently selected offset in the list.

 combobox.getSelectedItem(); 

To return the currently selected item in the list or null to select

+16
source

To get what you selected as a string:

 String selected_text = ComboBox.getItemAt(ComboBox.getSelectedIndex()); 
+1
source

Source: https://habr.com/ru/post/893485/


All Articles