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:
But I want to take the user directly to this screen:
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With