devz
devz

Reputation: 2829

How to open IME settings? Android Keyboard AOSP

I would like to provide the possibility to change some settings of the Android keyboard (only this keyboard).


What I've tried:

1. Accessing the Shared Preferences: Can't be done, because they are internally.

2. Start the SettingsActivity: This crashes because the SettingsActivity is not exported. I also tried starting it with the package context of the Android keyboard.

3. Open the settings: Android proviedes some possibilities to open the system settings. But with them I can only open the system settings and not the IME settings.

Based on the documentation the SettingsActivity should receive an intent filter for ACTION_MAIN that indicates this activity is the main entry point for the IME application.


Can I change the settings of the keyboard somehow by myself? If this is not possible can I open the SettingsActivity?

Upvotes: 1

Views: 1520

Answers (1)

remi0s
remi0s

Reputation: 87

I'm using LatinIME and this is how i open the settings

final Intent intent = new Intent();
intent.setClass(getApplicationContext(), SettingsActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
        | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED
        | Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra(SettingsActivity.EXTRA_SHOW_HOME_AS_UP, false);
intent.putExtra(SettingsActivity.EXTRA_ENTRY_KEY,false);
startActivity(intent);

Upvotes: 1

Related Questions