我想为黑莓开发一个应用程序,我想在屏幕上添加一个文本框。如果我在该文本框中输入任何单词,它应该从任何特定数据中为我提供相应的搜索结果(例如,联系人/任何列表)所以它是如何可能的?
答案 0 :(得分:0)
黑莓中的AutoCompleteField
可能是智能搜索的最佳选择。它可从BB5.0及以上版本获得。它提供了一个文本字段,并在您在文本框中输入时过滤数据和列表。
这是代码示例
BasicFilteredList filterList = new BasicFilteredList();
String[] address = { "T 115 Centro Galleria Shopping Centre, Cnr Old Collier and Walters Road Morley WA 1522",
"784 SEAVIEW POINT POINT COOK VIC 2674",
"Lot 1498 Yarraman Road Wyndham Vale VIC 3795",
"784 3506 Witchmount Close Hillside VIC 4055",
"6 Paas Place Williamstown VIC 4233",
"Lot 99 14 James Close Sunbury VIC 4502",
"1 Charlotte Street Clayton South VIC 4779" };
filterList.addDataSet(1, address, "days", BasicFilteredList.COMPARISON_IGNORE_CASE);
CustomAutoCompleteTextField autoCompleteField = new CustomAutoCompleteTextField(filterList, AutoCompleteField.LIST_EXPAND_ON_HIGHLIGHT)
{
public void onSelect(Object selection, int SELECT_TRACKWHEEL_CLICK) {
ListField _list = getListField();
}
//ListField _list = this.getListField();
public void fieldChanged(Field field, int context){
}
};
add(autoCompleteField);