Search code examples
blackberrycustom-lists

Custom List Field with Custom ObjectChoiceField in blackberry?


I am a new BB developer working on android simultaneously, I am preparing a project containing list and object choice fields in both the languages.

In blackberry, I have a list of 10 elements and on each element row I need to show an arrow button on click of that button a ObjectChoiceField will pops up.

Here, it is clear that the list and obejctchoice field both are custom.

I am very confused please let me know, how this can be achieved.

Thanx in advance..!:|enter image description here


Solution

  • // customize ListField How to customize a ListField in BlackBerry?

    To get clicked item just add below function to code

    protected boolean navigationClick(int status, int time) {
            Field field = this.getLeafFieldWithFocus();
    
            if(field instanceof ListField){
                System.out.println("navigationClick Yes Yes you clicked list item ");
                ListField listField = (ListField)field;
                // this will give you clicked index.
                        int index = listField.getSelectedIndex();
                // pop up your Object choice field here...
            }
            return true;
    }