Android ListView with Searchbox Sort items

This article is next step of Listexample. Here we have a search box which sorts the list view as when the content matches the list items.

Why do we need this?

Imagine that if we have 2K to 3K items in the listview, It will not be possible to  scrolldown till 2000th item.In this case this will be handy to cut short items.

To start with we add a edittext box and Listview added to LinearLayout.

[sourcecode language="xml"]

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout android:id="@+id/LinearLayout01"
xmlns:android="" android:orientation="vertical">

<EditText android:id="@+id/EditText01" android:layout_height="wrap_content" android:layout_width="fill_parent" android:hint="Search"></EditText><ListView android:id="@+id/ListView01"
android:layout_height="wrap_content" ></ListView>



Android EditorInfo Go, Search, Done, Next Example

There is always necessity to add extra keys apart from default keys available in virtual QWERTY keyboard. For instance we may need a direct search key by the side of edit text box in order to have direct triggering of Search actions.
For Instance to add a Search key we need to add this code, so that It may appear in the QWERTY board.

[sourcecode language="java"]

Syndicate content