Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

124
Vistas
Focus html input after returning from android intent in IME

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:

  1. User focused field
  2. User clicked on the button, was redirected with intent to new activity
  3. User got data, dismissed activity
  4. Field was refocused, data inserted.

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!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda