android: get text of a search suggestion clicked item -


i using officical android sample code searchabledictionary, gives search interface, can search word , while user types, suggestions displayed in dropdown listview.

when search suggestion clicked, intent sent searchable activity. action field of intent described though searchable xml this:

<searchable  ...     android:searchsuggestintentaction = "android.intent.action.view"> 

and in searchable activity:

intent intent = getintent(); if (intent.action_view.equals(intent.getaction()) {     //a suggestion clicked... it...     intent myintent = new intent(this, newactivity.class);     myintent.setdata(intent.getdata());     startactivity(myintent);     finish(); } 

my problem newactivity requires id display relevant data. id can getting text of item clicked (like using getitematposition(pos); ) [a string value]. how it?

i did it.

cursor cursor = managedquery(intent.getdata(), null, null, null, null); cursor.movetofirst(); string y = cursor.getstring(1).trim(); final int x = integer.valueof(y) - 1; myintent.putextra("id", y); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -