I was developing one notepad kind of thing in which user can enter in edit text, I have also provided one Auto complete text view which help him in writing quick word. but I am not getting how can I add the word from auto text box to edit box without disturbing previous written text.
MY Try: I tried this code
public void afterTextChanged(Editable s){
String c = s.toString(); // read Content
((EditText)view.findViewById(R.id.et_text_area)).setText(c);
}
public void beforeTextChanged(CharSequence s, int start, int count, int after){ }
public void onTextChanged(CharSequence s, int start, int before, int count){ }
});
which is coping the text in edit box but also deleting the previously written text. How can I add the word from AutoCompleteTextView to edit box without deleting anything and Also when user select any word, and word appear in edit box Auto text box should become empty.
Is there some API in android
Any help will be appreciated. Thanks in advance
Try using OnItemClickListener on your AutoComplete. When the user clicks at a word you can save the position of it. Use that int value to retrieve your word from the specified position of your ArrayList, Adapter or whatever it is your are using as datasource for your AutoCompleteList.