how to implement search box in my application in android?
i have one activity in my android application in which a list of orders is populated. I want to implement a search functionality on this activity so that user can search for particular order.
I have read about the search box facility provided by adding a searchable.xml
file in the application but I am not able to m开发者_C百科ake it work for me?
I just want to add a search box in the activity and search for specific data in database. How can I do this?
@VNVN I would agree - I would review the developer guide. http://developer.android.com/guide/topics/search/search-dialog.html
You will need to make your activity search-able in the AndroidMainfest.xml file
<activity android:name=".MySearchableActivity" >
<intent-filter>
<action android:name="android.intent.action.SEARCH" />
</intent-filter>
<meta-data android:name="android.app.searchable"
android:resource="@xml/searchable"/>
</activity>
You are probably missing creating a SearchableActivity. http://developer.android.com/guide/topics/search/search-dialog.html#SearchableActivity
精彩评论