Fix type of _id col in SearchableDictionary

SDK SAMPLE CODE ONLY

Before, the _id column in the search suggestions contained
a string. This causes an exception when the suggestion provider
is used for in-app search in Cupcake. Now the _id column contains
a long instead.

Fixes http://b/issue?id=2219970

Change-Id: I53c8228badbb0e3ff1799107490b44ff8ced7148
This commit is contained in:
Bjorn Bringert
2009-11-03 15:37:36 +00:00
parent f31f630320
commit 29017bbd62

View File

@@ -106,16 +106,17 @@ public class DictionaryProvider extends ContentProvider {
List<Dictionary.Word> words = Dictionary.getInstance().getMatches(processedQuery);
MatrixCursor cursor = new MatrixCursor(COLUMNS);
long id = 0;
for (Dictionary.Word word : words) {
cursor.addRow(columnValuesOfWord(word));
cursor.addRow(columnValuesOfWord(id++, word));
}
return cursor;
}
private Object[] columnValuesOfWord(Dictionary.Word word) {
return new String[] {
word.word, // _id
private Object[] columnValuesOfWord(long id, Dictionary.Word word) {
return new Object[] {
id, // _id
word.word, // text1
word.definition, // text2
word.word, // intent_data (included when clicking on item)