I have searched and looked into this issue all over the web but did not get a clear answer. I have added the words to the user dictionary using content provider as the android documentation states the words gets added but after that when i type onto the keypad i don't see the word appearing on the suggestions in candidates view as other words that we tap appear there next time. I would really appreciate a full answer to this problem as many people are asking it on the net and not getting answered. I have tried this
Uri mNewUri;
// Defines an object to contain the new values to insert
ContentValues mNewValues = new ContentValues();
// Sets the values of each column and inserts the word. The arguments to the "put"
// method are "column name" and "value"
mNewValues.put(UserDictionary.Words.APP_ID, "example.user");
mNewValues.put(UserDictionary.Words.LOCALE, "en_US");
mNewValues.put(UserDictionary.Words.WORD, "Qasim");
mNewValues.put(UserDictionary.Words.FREQUENCY, "100");
mNewUri = getContentResolver().insert(
UserDictionary.Words.CONTENT_URI, // the user dictionary content URI
mNewValues // the values to insert
);
Uri dic = UserDictionary.Words.CONTENT_URI;
ContentResolver resolver = getContentResolver();
Cursor cursor = resolver.query(dic, null, null, null, null);
//here i retrieve all the words stored into my dictionary
while (cursor.moveToNext()){
String word = cursor.getString(cursor.getColumnIndex(UserDictionary.Words.WORD));
int id = cursor.getInt(cursor.getColumnIndex(UserDictionary.Words._ID));
String app = cursor.getString(cursor.getColumnIndex(UserDictionary.Words.APP_ID));
int frequency = cursor.getInt(cursor.getColumnIndex(UserDictionary.Words.FREQUENCY));
String locale = cursor.getString(cursor.getColumnIndex(UserDictionary.Words.LOCALE));
Log.i("", "word: "+word+"\nId: "+id+"\nAppID: "+app+"\nfrequency: "+frequency+"\nLocale:"+locale);
}
Would appreciate if someone helps me out here