How can i auto-fill an edit text from it's mid?

时间:2018-02-26 17:51:05

标签: java android autocomplete android-edittext android-arrayadapter

I am working on a contact manager project for android.In which i want to auto-fill the email address ending part in the field at the time of signup by the user. For example when user type his or her username it should be automatically gives the suggestion for @gmail.com or @outlook.com and so on.

Well,This is a little part of my code

String[] maindb = {"@gmail.com", "@rediffmail.com", "@hotmail.com", "@outlook.com"};

mail = (AutoCompleteTextView) findViewById(R.id.A1_edt_mail);

ArrayAdapter<String> adpt = new ArrayAdapter<String>(this, R.layout.support_simple_spinner_dropdown_item, maindb);
mail.setAdapter(adpt);

Well, I got output like this

Image is here

But I want that when user enter his/her username then this suggestion should be appear but it din't.

Image is here

Well, My question is not duplicate of android how an EditText work as AutoComplete this question.My problem is differ from this.

Thanks in advance.

0 个答案:

没有答案