Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 55
Registered: ‎02-08-2010
My Device: Blackberry Bold
My Carrier: Verizon

Auto suggest

Hi,


I can't seem to find anything about an autosuggest text field for Blackberry.

 

I basically need to make an autosuggest box, that retrieves data from a webservice as the user types.

 

Is this possible?

 

Thanks,

Teja

Developer
Posts: 141
Registered: ‎02-10-2010
My Device: 9500
My Carrier: Airtel

Re: Auto suggest

It is possible technically. You may do the service calling from the keyChar method.

 

However, practically, the network latency involved in fetching the autosuggest list and providing on the UI while the user is typing a word looks infeasible.

Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Auto suggest

Agree completely with PoojaMaheshwari (though I would do the processing using a FieldChangeListener rather than keyChar).

Developer
Posts: 587
Registered: ‎01-19-2010
My Device: BOLD 9700 OS5.0.0.x on Rogers Canada
My Carrier: Rogers

Re: Auto suggest

I agree that it would be infeasible to make dynamic calls to a web service as the user types, but if you make a call to the web service as the program initiates and store the pertinent data in a local database of some kind (providing what you want to store isn't excessively large), you could access that in real time without too much overhead.

----------------------------------------------------------------------------
chown -R us ./base
~J!NX
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: Auto suggest

In which case, the only Field that I am aware that might help you with this is the AutoCompleteField available in OS 5.0.  There is no equivalent that I am aware of in any earlier OS. 

New Developer
Posts: 10
Registered: ‎01-28-2010
My Device: --

Re: Auto suggest

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

 

Autocomplete Class Reference API JDE 5.0

 

How to get the selected item as String. Below is a snippet from code

 

 

AutoCompleteField autoCompleteField = new AutoCompleteField(filterList)
        {
        	public void onSelect(Object selection,
                    int SELECT_TRACKWHEEL_CLICK) {
        		
        		ListField _list = getListField();
      		 if (_list.getSelectedIndex() > -1)

                 {
                      Dialog.alert("You selected: "+_list.getSelectedIndex());
		      // get text selected by user and do something...
                      
                 }
           	
            }
	};