0

I am making app for finding number plates of india. my database contains two columnns "code" and "city" code contains data like MH1,MH2 etc. and city contains data like Pune,Mumbai.

App contains one edittext box and listview.

Listview consists whole data from database like GJ3 Rajkot, GJ10 Jamnagar etc.

If I write GJ in edittext box whole only data of GJ must be appear in the listview.

I got this query from one person but how can i integrate with edittext box

Cursor c = mDb.rawQuery(
        "select * from table_name where column_name = ?",
        new String[] { "search" });
keyser
  • 18,829
  • 16
  • 59
  • 101
Pavan Anadkat
  • 111
  • 1
  • 3
  • 9

1 Answers1

0

Just use an AutoCompleteTextView instead of normal EditText.

I think you'll find this useful : http://developer.android.com/resources/tutorials/views/hello-autocomplete.html

Please see following link: http://www.androidhive.info/2012/09/android-adding-search-functionality-to-listview/

Shrikant Ballal
  • 7,067
  • 7
  • 41
  • 61
  • You can also see: http://hello-android.blogspot.in/2011/06/using-autocompletetextview-with-sqlite.html – Shrikant Ballal Oct 11 '12 at 10:13
  • This is also useful: http://www.outofwhatbox.com/blog/2010/11/android-autocompletetextview-sqlite-and-dependent-fields/ – Shrikant Ballal Oct 11 '12 at 10:25
  • If i use only AutoCompeleteTextView then it will fetch only static data i want to fetch it from dataabase how can i do this ? – Pavan Anadkat Oct 11 '12 at 13:33
  • You can get the example from following link: http://stackoverflow.com/questions/9912399/using-cursorloader-to-query-sqlite-db-and-populate-autocompletetextview – Shrikant Ballal Oct 11 '12 at 14:17
  • i am enable to search a data from database for example if i write AR in edittext it display all records of AR but it display only in Log cat...Whenever i type anything in Edittext box Listview is diappeared..now i want to display the same data which displays in logcat – Pavan Anadkat Oct 13 '12 at 15:00