Query words from user dictionary android

268 views Asked by At

I am trying to check whether the given string is word or not. for this I am trying to query words from user dictionary but it is returning 2 strings (not even a word).

cursor = getContentResolver().query(
                        UserDictionary.Words.CONTENT_URI, // The content URI of
                                                            // the words table
                        mProjection, // The columns to return for each row
                        null, // Either null, or the word the user
                                            // entered
                        null, // Either empty, or the string the user
                                        // entered
                        null);                      



             if (cursor.getCount() < 1) {
                    // Word is not in dictionary
                    Toast tst = Toast.makeText(getApplicationContext(),
                            "Word is not in dictionary ", Toast.LENGTH_SHORT);
                    tst.show();                     

                } else {
                    Toast tst = Toast.makeText(getApplicationContext(),
                            "Word is in dictionary", Toast.LENGTH_SHORT);
                    tst.show();
                    int index = cursor.getColumnIndex(UserDictionary.Words.WORD);

                    while (cursor.moveToNext()) {

                        // Gets the value from the column.
                   Log.i("words",""+cursor.getString(index));

                        // Insert code here to process the retrieved word.

instead of displaying all words in the dictionary it is displaying 2 strings. // end of while loop } }

0

There are 0 answers