Detained Developer
Detained Developer

Reputation: 1314

Text Prediction functionality for Custom Keyboard

I have developed a Basic Keyboard.

Here is how it looks :

Now, I want to add the Predictive Text Functionality.

I did some research and found some information about Backend part of it. Which showed how the keyboard can learn from user to user.

But I could not find the Front End Part (XML) of it Anywhere.

If this question seems hoax to you, please let me know.

Upvotes: 3

Views: 2699

Answers (1)

Chetan Joshi
Chetan Joshi

Reputation: 5711

You can go to below solution :How to include suggestions in Android Keyboard

ou can use the static method UserDictionary.Words.addWord(....): Link

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);
}

You will need to add this permission to your manifest:

Added words will appear in

Settings > Language & input > Personal dictionary

.

Upvotes: 0

Related Questions