User dictionary in Settings

by Jaden Pak » Fri, 20 May 2011 09:34:00 GMT


Sponsored Links
 Hi, all!

I'm developing some test codes for Android Settings(native app).

But I have some difficulties finding out what the real SQLite table is
for User dictionary words.

Does anyone have an idea about this?
In UserDictionary.java (which seems to be a provider class), I can see
only addWord() method.
In order to learn how to insert, update or delete in SQLite table,
which source file should I
check ?

Thanks in advance!

-- 



Re: User dictionary in Settings

by Brill Pappin » Fri, 20 May 2011 12:09:42 GMT


 android.provider.UserDictionary is a simple content provider.
You should be able to query it any way you like. You likely want the
Words content.

You might need to read up on content providers if you are not familiar
with them.
However, remember that the UserDictionary is not just used by your
app, so be careful what you do with it!

- Brill





-- 


Sponsored Links


Other Threads

1. mediaplayer's onCompletionListener never called on playing 3gpp/amr audio files

In order to be notified when the clip finishes playing, I use the
callback:

                player.setOnCompletionListener(new OnCompletionListener() {
                        @Override
                        public void onCompletion(MediaPlayer mp) {
                                Toast.makeText(getApplicationContext(), "media 
player. play
complete", Toast.LENGTH_SHORT).show();
                        }
                });

Unfortunately it is never called - I am playing 3gpp/amr audio files.

Is there another way to do this?
thanks,
Anil

-- 

2. Searchable dictionary results are not being shown in global search

Hello,

I have tried to implement the searchable dictionary sample app.
Everything seems to be working except when I try to pull the results
from global search.
I have tried to follow everything that has been described in the docs
too.

My searchable.xml
<searchable xmlns:android="http://schemas.android.com/apk/res/android"
        android:label="@string/search_label"
        android:hint="@string/search_hint"
        android:searchSettingsDescription="@string/
settings_description"
 
android:searchSuggestAuthority="sd2.com.achie.DictionaryProvider"
        android:searchSuggestIntentAction="android.intent.action.VIEW"
        android:searchSuggestIntentData="content://
sd2.com.achie.DictionaryProvider/dictionary"
        android:searchSuggestSelection=" ?"
        android:searchSuggestThreshold="1"
        android:includeInGlobalSearch="true"
        >
 </searchable>

And the authorities, mime types

    public static String AUTHORITY =
"sd2.com.achie.DictionaryProvider";
    public static final Uri CONTENT_URI = Uri.parse("content://" +
AUTHORITY + "/dictionary");

    public static final String WORDS_MIME_TYPE =
ContentResolver.CURSOR_DIR_BASE_TYPE +"/vnd.sd2.com.achie";
    public static final String DEFINITION_MIME_TYPE =
ContentResolver.CURSOR_ITEM_BASE_TYPE +"/vnd.sd2.com.achie";

My Manifest is

    <application android:icon="@drawable/ic_dictionary"
android:label="@string/app_name">
        <activity android:name=".SearchableDictionary"
                  android:theme="@android:style/Theme.NoTitleBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <!-- Receives the search request. -->
            <intent-filter>
                <action android:name="android.intent.action.SEARCH" />
                <!-- No category needed, because the Intent will
specify this class component-->
            </intent-filter>

            <!-- Points to searchable meta data. -->
            <meta-data android:name="android.app.searchable"
                       android:resource="@xml/searchable" /

        </activity>
        <!-- Displays the definition of a word. -->
        <activity android:name=".WordActivity"
                  android:theme="@android:style/Theme.NoTitleBar" />

        <!-- Provides search suggestions for words and their
definitions. -->
        <provider android:name=".DictionaryProvider"
 
android:authorities="sd2.com.achie.DictionaryProvider" />

        <!-- Points to searchable activity so the whole app can invoke
search. -->
        <meta-data android:name="android.app.default_searchable"
                   android:value=".SearchableDictionary" />
    </application>

What might be the problem?

Thank you,
Achie

-- 

3. One night with the gurus

4. Why doesn't AlarmManager allow querying or browsing of alarms or pending intents?

5. AppWidget update called three times on boot up

6. control for user file selection

7. Gallery Cache