New Activity dismissing keyboard in InputMethodService
Question
I'm writing a custom keyboard for Android and I'm using InputMethodService
to handle all keyboard-related events.
On a certain event, I present an Activity
with Theme.Dialog
theme to the user, but when it's presented, it dismisses currently visible KeyboardView
and I want the keyboard to stay visible under the running activity.
Is there a way to avoid dismissing the keyboard or maybe there are more efficient ways to present a dialog with a few buttons to the user from a running Service
?
Activity declaration in AndroidManifest.xml
:
<activity
android:name=".EditActivity"
android:label="@string/edit_title"
android:theme="@android:style/Theme.Dialog"
/>
The code used to present the activity:
Intent intent = new Intent(getApplicationContext(), EditActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
Thanks in advance!
//UPDATE
Everything works correctly and KeyboardView
is brought back when the Activity
is not transparent, so removing the theme declaration:
android:theme="@android:style/Theme.Dialog"
fixes everything. So the question is, how to present a translucent Activity
without dismissing the KeyboardView
?
Solution
Okay I figured out how to do it, here is my answer to a different question with the solution: https://stackoverflow.com/a/13652456/285680