tags:

views:

33

answers:

1

Friend's I'm working upon searching in maps, here i have string in my array,when i enter characters for searching in Edit text box,i need the string have started with similar character in my result.
for example in my array i have String[] name ={"A","B","BB","Boys","Box"}

Initially i have all the array string in my result,if i suppose enter an character like b in editbox i need filter and show the charcters matches with b that is "B","BB",""Boys","Box",if suppose i enter two characters like "bo"in editbox ,i need result strings "Boys","Box"in another array. Help me.

thanks in advance.

+1  A: 

Consider using AutoCompleteTextView instead of simple EditText.

Ralkie
If you please give me little brief about this.I can't understand..
MGS
Have a look at the documentation: http://developer.android.com/intl/de/reference/android/widget/AutoCompleteTextView.html
Dave Webb
Well, AutoCompleteTextView is meant for such functionality. It looks like EditText, but you can populate it with array of strings (using ArrayAdapter) and drop-down of suggestions will pop up when you will start entering text (exactly as you described).
Ralkie
I tried the sample given in the document,but it doesn't show the string in the dropdown list,what is wrong with it,it simple displays the autocompltetextview box with out string content,please help me
MGS
Populating AutoCompleteTextView is very similar to populating ListView or Spinner. Did you set completionThreshold attribute to desired value (1 in your case)? In general, latter problem description is too laconic to really answer what is causing that.
Ralkie
thanks for your answer
MGS
here we set threshold for setting characters to match array of strings from array and then display's it,how can i display all the array content initially,before entering characters
MGS