Advertisement
royale1223

Quick Search Box

Dec 11th, 2011
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. Quick Search Box
  2. ----------------
  3.  
  4.  
  5. I'm trying to implement custom suggestions for qsb. I have added `CREATE TABLE IF NOT EXISTS suggestion_table (_id INTEGER PRIMARY KEY AUTOINCREMENT, suggest_text_1 VARCHAR(50),suggest_intent_data INTEGER)` as suggestions table. The output of of `intent.getDataString()` is only `content://com.simple.search.SuggestionProvider/tests`. I'm real confused here. I thought it would give the value of `suggest_intent_data`. How can I get the content of column `suggest_intent_data` from the `intent`?
  6.  
  7. if (Intent.ACTION_VIEW.equals(intent.getAction())) {
  8. Log.d(Tag.getTag(this), (intent.getDataString()));
  9. };
  10.  
  11.  
  12. **From http://developer.android.com/guide/topics/search/adding-custom-suggestions.html**
  13.  
  14. > Define the data for each suggestion inside the
  15. > SUGGEST_COLUMN_INTENT_DATA column of your suggestions table.
  16. >
  17. > Provide all necessary data information for each intent in the
  18. > suggestions table by including the SUGGEST_COLUMN_INTENT_DATA column
  19. > and then populating it with unique data for each row. The data from
  20. > this column is attached to the intent exactly as you define it in this
  21. > column. You can then retrieve it with with getData() or
  22. > getDataString().
  23.  
  24. **searchable.xml**
  25.  
  26. <?xml version="1.0" encoding="utf-8"?>
  27. <searchable xmlns:android="http://schemas.android.com/apk/res/android"
  28. android:hint="@string/search_hint"
  29. android:label="@string/app_label"
  30. android:searchSuggestAuthority="com.simple.search.SuggestionProvider"
  31. android:searchSuggestIntentAction="android.intent.action.VIEW"
  32. android:searchSuggestIntentData="content://com.simple.search.SuggestionProvider/tests" //yeah, I thought this was causing the problem too. But after removing this line no change.
  33. android:searchSuggestThreshold="1"
  34. android:searchSuggestSelection=" ?"
  35. />
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement