[Android] Allowing the user to enter a filter for a ListView

Back in Using an ArrayAdapter to Control a ListView’s Data, I wrote about filtering a ListView using its setTextFilterEnabled method. One of the comments reminded me that that not all devices have a physical keyboard and the virtual keyboard does not always show when entering the filter. For devices that do not have a physical keyboard, you could ask the InputMethodManager to display the virtual keyboard:

InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.showSoftInput(getListView(), 0);

Read more of this post


[Android] Using the SQLite Database with ListView

The dev guide provides information on how to set up a database for your application. This essentially involves extending SQLiteOpenHelper and overriding its onCreate and onUpgrade methods. Both methods are given a SQLiteDatabase object, which you use to execute the SQL queries to setup the database. In the following example, the a table called names is created with three columns – an id column and first and last columns for storing the first and last names, respectively, and inserts a couple of initial entries.
Read more of this post

[Android] Filtering a ListView using an ArrayAdapter

The contents ListView can be filtered by the users input when it is enabled. The filter input is enabled by calling its setTextFilterEnabled method. When this is called, the next sequence of user’s input will taken as the filter for the list. The initial contents of the filter is set programatically by using the setFilterText method.

Read more of this post

[Android] Using an ArrayAdapter to Control a ListView’s Data

Data inside a ListView supplied by a ListAdapter. The manipulation of data, such as adding and removing items, is done through the adapter. The adapter will automatically make the ListView update itself to correspond to the change. The source for the list is set with by calling setAdapter with the source adapter. In this tutorial, an ArrayAdapter is used with a ListView.

Read more of this post