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
Contributor
Posts: 36
Registered: ‎09-28-2011
My Device: 9530
My Carrier: docomo

How to set event listener to auto complete field in blackberry?

I am developing one application.In that app  i am using Auto Complete Field in blackberry.Now i want to know that when i enter any value in that field it will return me result according to input.Now i want to take action when clicked by user on particular result out of 3/4 result returned by querry. so how could it be possible?

As an e.g consider when you are searching for particular contact in contact list.you enter A word in textbox then it will return result like abhi,ami,ani etc.which is possible using filtered list and autocomplete field in blackberry but when i click on ami it should divert me to details of ami.how could it be possiblei.e event handling on auto complete field?


Developer
Posts: 78
Registered: ‎05-17-2012
My Device: 9900 - OS 7.0 Torch device
My Carrier: Reliance

Re: How to set event listener to auto complete field in blackberry?

Hi
I think you can write the navigation click based on your selected index value. If you select value like ami, you can get the selected index value for which you can do your action event. like below
autoCompleteField = new AutoCompleteField(filterList, AutoCompleteField.LIST_STATIC | AutoCompleteField.LIST_DROPDOWN)
{
protected void sublayout(int maxWidth, int maxHright)
{
super.sublayout(ctf_search_X, ctf_search_Y);
setExtent(ctf_search_X, ctf_search_Y);
}
protected void onFocus(int direction)
{
super.onFocus(direction);
invalidate();
}
protected void onUnfocus()
{
super.onUnfocus();
invalidate();
}
protected void paint(Graphics graphics) {

super.paint(graphics);
}
protected boolean keyDown(int keycode, int time)
{
super.keyDown(keycode, time);

return super.keyDown(keycode, time);
}
protected boolean navigationClick(int status, int time)
{
Object indexvalue = autoCompleteField.getSelectedObject();
return true;
}


};
Highlighted
Contributor
Posts: 36
Registered: ‎09-28-2011
My Device: 9530
My Carrier: docomo

Re: How to set event listener to auto complete field in blackberry?

sorry but navigation click event doesn't work for me.