Development of the app has a search function, and need to display the history of the search, I spare no time to help her develop this feature, now the page is extracted into a demo to share to everyone.
implementation effect:
This case is very simple to implement, so it can be directly embedded in the project to use, involving the knowledge point:
- Database additions and deletions change operation
- ListView and ScrollView nested conflict resolution
- Monitor soft keyboard return button set to search button
- use Textwatcher () real-time filter
- Search keywords searched again not repeatedly added to the database
- just entered the page Setup soft keyboard does not automatically eject because of EditText
code
-
Recordsqliteopenhelper.java
Mainactivity.java
Mylistview.java
Activity_main.xml
Android Search feature case, save search history locally ...