Reputation: 11
I have a pretty basic IME soft keyboard written in java. I also have a website with basic HTML text inputs.
My keyboard has one special button that launches activity. There I can read data from NFC chip and send them back. That works fine, I return to my website. But since the keyboard is closed now, my text string is not pasted into input until I click on it.
Is there any way to force the input field to act like google searchview? Like this:
I use this piece of code to commit my text
public void onStartInputView(final EditorInfo editorInfo, final boolean restarting) {
if (hasMessages(MSG_PENDING_IMS_CALLBACK)
&& KeyboardId.equivalentEditorInfoForKeyboard(editorInfo, mAppliedEditorInfo)) {
// Typically this is the second onStartInputView after orientation changed.
resetPendingImsCallback();
} else {
if (mPendingSuccessiveImsCallback) {
// This is the first onStartInputView after orientation changed.
mPendingSuccessiveImsCallback = false;
resetPendingImsCallback();
sendMessageDelayed(obtainMessage(MSG_PENDING_IMS_CALLBACK),
PENDING_IMS_CALLBACK_DURATION_MILLIS);
}
final LatinIME latinIme = getOwnerInstance();
if (latinIme != null) {
executePendingImsCallback(latinIme, editorInfo, restarting);
latinIme.onStartInputViewInternal(editorInfo, restarting);
mAppliedEditorInfo = editorInfo;
CharSequence text = DataHolder.getData();
if (text != null)
{
latinIme.getCurrentInputConnection().commitText(text, 1);
DataHolder.setData("");
}
}
cancelDeallocateMemory();
}
}
Seems like that works fine - since the keyboard is closed after activity return I can't commit text.
I'm getting kinda desperate as I'm stuck on this for a few days already. Thanks!
Upvotes: 1
Views: 106