Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spell checker settings intent Android

In Android, I can launch the Keyboard & Input Settings dialog using the ACTION_INPUT_METHOD_SETTINGS intent:

getPresenter().startActivity(new Intent(Settings.ACTION_INPUT_METHOD_SETTINGS));

Question: How can I open the "Spell Checker" settings dialog (available in Jelly Bean+) so that the user can enable my service?

Example: I can get to it from the Language & Input settings: Language and input settings

But I want to take the user directly to this screen: Spell Checker settings

like image 241
CodingIntrigue Avatar asked Sep 16 '13 08:09

CodingIntrigue


2 Answers

Here you go:

ComponentName componentToLaunch = new ComponentName("com.android.settings", 
        "com.android.settings.Settings$SpellCheckersSettingsActivity");

        Intent intent = new Intent();
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        intent.setComponent(componentToLaunch);
        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

        try {
            this.startActivity(intent);
        } catch (ActivityNotFoundException e) {
            //TODO
        }

You can find out the names of other Activities by starting the Activity and lookup the Intent used in Logcat. The output for me was:

I/ActivityManager(  589): START u0 {act=android.intent.action.MAIN cmp=com.android.settings/.Settings$SpellCheckersSettingsActivity} from pid 13084
like image 99
Force Avatar answered Oct 10 '22 04:10

Force


Yes, It is Possible..:)

Intent intent = new Intent();
intent.setComponent(new ComponentName("com.android.settings","com.android.settings.Settings$SpellCheckersSettingsActivity"));
startActivityForResult(intent);

We create an explicit intent, and we have to launch the com.android.settings.Settings$SpellCheckersSettingsActivity component. For Future Reference, You can use LogCat in eclipse to find whatever package or component you are trying to launch. Just look at the ActivityManager's Starting activity messages and you will see the package and component name of any Activity.

like image 34
Augustus Francis Avatar answered Oct 10 '22 03:10

Augustus Francis