1. Create a new project in Eclipse File New ⇒ Android ⇒ Application Project and fill the required details.
2. Create required files needed to generate a listview. I am using my defaultactivity_main.xml as listview and created a new xml file for single listitem namedlist_item.xml. Also make sure that you have created a EditText above the listview which will be used to search the listview.
activity_main.xml
Enabling Search Functionality
4. Search functionality can be enabled by writing simple lines of code. All you need to do is adding addTextChangedListener to EditText. Once user enters a new data in EditText we need to get the text from it and passing it to array adapter filter. All the following code in your MainActivity.javaandroid:windowSoftInputMode="stateHidden" |
No comments:
Post a Comment