How to get the selected item as String in a Blackberry AutoCompleteField?

后端 未结 2 1440
梦毁少年i
梦毁少年i 2021-01-20 03:00

How to get the selected Item as string when using a Blackberry AutoComplete Field. I am able to get the selected index currently. I am Overriding the onSelect method in the

2条回答
  •  悲哀的现实
    2021-01-20 03:43

      /*  
    onSelect
    
        protected void onSelect(Object selection,
                                int type)
    
        Parameters:
        *selection - The selected item*
        type - The method of selection. This will be one of SELECT_TRACKWHEEL_CLICK SELECT_TRACKBALL_CLICK SELECT_ENTER
    
    */
    
    BasicFilteredList filterList = new BasicFilteredList();
            String[] days = {"Monday","Tuesday","Wednesday",
                             "Thursday","Friday","Saturday","Sunday"};
            filterList.addDataSet(1,days,"days",BasicFilteredList.COMPARISON_IGNORE_CASE);
    
            AutoCompleteField autoCompleteField = new AutoCompleteField(filterList){
                protected void onSelect(Object selection, int type) {
                    BasicFilteredListResult result = (BasicFilteredListResult) selection;
                    Dialog.alert("You selected: "+ result._object);
                    super.onSelect(selection, type);
                }
            };
            add(autoCompleteField);
    

提交回复
热议问题