0

Is there any event to detect auto suggestion word selected( dictionary) android keyboard.

below is the code which i am using to detect

    private final TextWatcher mTextWatcher = new TextWatcher() {
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {

    }

    @Override
    public void afterTextChanged(Editable s)
    {  
    }
};
karthik
  • 347
  • 1
  • 9

1 Answers1

0

Fine you may be use this

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
// On JellyBean & above, you can provide a shortcut and an explicit Locale
UserDictionary.Words.addWord(this, "MadeUpWord", 10, "Mad", Locale.getDefault());
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.CUPCAKE) {
UserDictionary.Words.addWord(this, "MadeUpWord", 10, UserDictionary.Words.LOCALE_TYPE_CURRENT);
}
Nazim ch
  • 834
  • 8
  • 20
  • for more reference [click](http://stackoverflow.com/questions/29031402/how-to-include-suggestions-in-android-keyboard) – Nazim ch Feb 02 '17 at 04:59
  • above code is to add word to dictionary, but i want to know the event when we click on suggestion(dictionary) that will place the word in text View – karthik Feb 02 '17 at 06:02
  • this link may be helpful [click](https://developer.android.com/guide/topics/search/adding-custom-suggestions.html) – Nazim ch Feb 02 '17 at 07:27
  • also [refer](http://developer.android.com/reference/android/provider/UserDictionary.html) and [this too](http://developer.android.com/reference/android/provider/UserDictionary.Words.html) – Nazim ch Feb 02 '17 at 07:31