Understanding GridView in Android with Custom Adapters by Building an Image Gallery

GridView is a ViewGroup just like ListView that allows us to display items in a two-dimensional scrolling grid. Just like a ListView the data into a GridView is populated by an Adapter (ListAdapter) that fetches data from various sources like an array or a database. It’s mostly used to build image, video, audio galleries.

Continue reading “Understanding GridView in Android with Custom Adapters by Building an Image Gallery”

Android Realtime (Instant) Search with Filter Class and Filterable Interface Using Custom and Inbuilt Adapter

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 Adapter implementations.

Continue reading “Android Realtime (Instant) Search with Filter Class and Filterable Interface Using Custom and Inbuilt Adapter”

Adding Search Functionality to Your Android Application Activity with SearchView and Search Dialog

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.

Continue reading “Adding Search Functionality to Your Android Application Activity with SearchView and Search Dialog”

Quick Tip: Android Change Action Bar SearchView Hint (Placeholder) and Text Color

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:

Continue reading “Quick Tip: Android Change Action Bar SearchView Hint (Placeholder) and Text Color”

Understanding Android Spinners and Populating Them with (Adding) a Set of Items

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 TextView or EditView):

Continue reading “Understanding Android Spinners and Populating Them with (Adding) a Set of Items”

Android Dividing Your ListView Into Sections with Group Headers

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.

Continue reading “Android Dividing Your ListView Into Sections with Group Headers”