Android has an excellent
Fitler class that helps us filter data from an entire data set based on some pattern (for example a string) provided. Filters are usually created by classes implementing the
Filterable interface. It makes sense to use filters (implement the
Filterable interface) mostly with adapters, which means
Filterable classes are usually
If you’re building an android application, then most likely you’ll need to implement a search in it to let the user search through a set of data that could be emails, messages, chats, photos, files, etc. Android provides us with a search widget called SearchView that provides a user interface for the user to enter a search query and submit the request. The preferred way to use this widget to provide search in our application is to use it in the action bar.
There are times when you’ll want to change the hint (placeholder) color and the text color of a SearchView widget. Here’s a small snippet that’ll allow us to do it:
In this article we’ll build a login screen which will be somewhat similar to whatsapp’s login screen. So the login and registration screens will actually be the same and the unique identifier for each user will be their phone numbers. So to quickly summarize, here are the fields we’ll have:
Spinners in Android are like
select dropdowns (HTML) of web development. Once tapped, it shows a list of options in a dropdown menu from which one can select a value. It is very simple to add it as a View in the Layout file (just as any other view like
ListView is commonly used to display a set of data in a list. For example a list of emails, messages, tasks or contacts. I’ve written an article on how to work with lists in android before, which you might want to read.
There are times when you want to display data as a list. For example a list of emails, a list of messages, a list of tweets, a list of post titles, a list of photos with their titles and other meta data like dates and summary. Android provides 2 classes with the help of which we can achieve a scrollable list of items in our mobile application:
- ListView – Show items in a vertically scrolling list.
- ExpandableListView – Similar to
ListView but supports grouping of items that can be expanded individually to show its childrens.