0

I was making android keyboard using the same structure of the sample keyboard in SDK. I have an option button on the keyboard. I want this button to open the preference activity. Here is the code part:

if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) {
        Intent i = new Intent(this, ImePreferences.class);
        startActivity(i);           
    }

The keyboard freezes when i press the option button. Anybody with a better solution?

Mati Bekuma
  • 60
  • 1
  • 7

1 Answers1

0
if (primaryCode == LatinKeyboardView.KEYCODE_OPTIONS) {
    Intent i = new Intent(this, ImePreferences.class);
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(i);           
}

As you can see, the intent requires adding a flag which specifies new task/activity.

Rocker2000
  • 30
  • 6
  • Actually I found the answer on http://stackoverflow.com/questions/3606596/android-start-activity-from-service .. The Keyboard is a service. Anyways Thanks. – Mati Bekuma Jan 21 '14 at 05:21