hello everyone I want develop application which have many item in array list and one Edit text for using search item fast in list view I show u image like that:
so how it possible in page
hello everyone I want develop application which have many item in array list and one Edit text for using search item fast in list view I show u image like that:
so how it possible in page
I used this code to make an auto complete Edittext by using a simple edittext.
public class MainActivity extends Activity implements OnKeyListener {
}
have you checked Arrayadapter's filter method you need to set textwatcher and in textchange method you need to call adapter.filter("word entered in edittext") and you done for more detail check this
Try Auto Complete Text View available in Android.Its Edit text with Search functionality in android.
You dont need to write code for filtering with the use of Auto Complete Text view
For source code have a look at this sample.
You can ask if you have any queries.Happy coding :)
What you're trying to do might be achieved with
AutoCompleteTextView
, so you'll have to change yourEditText
by it.Further, you'll need to extend your own
ArrayAdapter
, and inside it, extend yourFilter
class and declare an instance of your extended filter class. In theFilter
extension, you'll need to override the following methods:FilterResults performFiltering(CharSequence)
: There you implement how you want to filter.void publishResults(CharSequence, final FilterResults)
: You'll receive here the results you've returned fromFilterResults
as the second parameter. Simply callnotifyDataSetChanged()
if you have more than one item.This way you'll be able to filter the way you want. A good example might be found here.
You need to add addTextChangedListener to your EditText. when user enters a new data in EditText , get the text from it and passing it to array adapter filter. you can add like this :
});
Full example is here
my code is here