I am having trouble with the getSelectedIndex() method of ObjectListField.
Supposedly, when there is no selected index, it returns -1. But how come it always returns the index of the last item?
To demonstrate, i created my own dialog that has a similar functionality to the "Select Device Dialog" of the Bluetooth application in BB. I have an ObjectListField and a Cancel Button. What i simply did is change the label of the button to show the selected index. I have attached my sample code below.
public class MyDialog extends Dialog
private ObjectListField m_list;
private ButtonField m_btn;
public MyDialog ()
m_list = new ObjectListField();
m_btn = new ButtonField("Cancel",Field.FIELD_HCENTER);
protected boolean navigationClick(int status, int time)
Can somebody help me on this problem? Is there something wrong with my code or is the API buggy? All i want to happen is to return a -1 index if there is no item selected in the list.
Also, I have tried the isFocus() method using it to check if the list is being focused, it always returns false eventhough the list is OBVIOUSLY being focused. I have run out of options on how to determine the solution to this problem. please help!
Thanks a lot.