custom suggestion:於繼承content provider之query()中加入:
String query = uri.getLastPathSegment().toLowerCase();
MatrixCursor test=new MatrixCursor(new String[] { SearchManager.SUGGEST_COLUMN_INTENT_DATA,SearchManager.SUGGEST_COLUMN_TEXT_1,"_ID" });
test.addRow((new Object[] {"10" , "a","1" }));
test.addRow((new Object[] {"20", "aa","2" }));
test.addRow((new Object[] { "30","aaa","3" }));
Cursor c=test;
最後return c;
可在search bar中找到a,aa,aaa等選項…
沒有留言:
張貼留言