Keyboard in browser component

93 views
Skip to first unread message

Carlos Verdier

unread,
May 27, 2014, 9:16:46 AM5/27/14
to codenameone...@googlegroups.com
Hi

I know this issue has been dicussed here:

http://bit.ly/SKpYZ2

But I´m experiencing what I think is the same problem. I have a browser component in a center borderlayout. Works fine but fails to pop the keyboard in Google or any other web page.

Was it fixed? It´s said to be sorted out in the thread, but not for my app. Please, let me know if you need more details.

Thank you

Chen Fishbein

unread,
May 27, 2014, 10:35:18 AM5/27/14
to codenameone...@googlegroups.com
This bug is chasing us... can you post your Form code? are you experiencing this on a specific android version?

Carlos Verdier

unread,
May 27, 2014, 2:31:31 PM5/27/14
to codenameone...@googlegroups.com
Yes, and I go picking up all of them :)

I´m using the Designer so... I can post the most relevan part, I hope it´s enough

I´ve tried in two devices with no luck:

Phone: Sony ST25i
Tablet: Galaxy Note 10.1

Thanks

    private void startNavegador(final Form f) {
Form f = Display.getInstance().getCurrent();
       
String textoUrl = TextoUrl.getText();    
       
if (findContainerBrowser(f).getComponentCount() == 0) {
           
Navegador = new BrowserComponent();
           
Navegador.addWebEventListener("onError", new ActionListener() {
               
public void actionPerformed(ActionEvent evt) {
                   
if ( detectaInternet()) {                        
                       
String textoUrl = TextoUrl.getText();
                        textoUrl
= "https://" + textoUrl;
                       
Navegador.setURL(textoUrl);
                   
}
               
}                    
           
});
           
Navegador.addWebEventListener("onLoad", new ActionListener() {
               
public void actionPerformed(ActionEvent evt) {                    
                   
TextoUrl.setText(Navegador.getURL());
               
}
           
});
           
if ( ! textoUrl.startsWith("http") ) {
                textoUrl
= "http://" + textoUrl;
           
}                      
            findContainerBrowser
(f).addComponent(BorderLayout.CENTER, Navegador);
            findContainerBrowser
(f).revalidate();
       
}    
       
if ( ! textoUrl.equals("http://") )
           
Navegador.setURL(textoUrl);        
   
}

   
(…..........)

   
@Override
   
protected void onRecetas_Button6Action(Component c, ActionEvent event) {
       
Form f = c.getComponentForm();
        accionNavegador
(TextoUrl);
   
}
   
private void accionNavegador(TextField TextoUrl) {
       
String textoUrl = TextoUrl.getText();
       
if ( ! textoUrl.startsWith("www") && ! textoUrl.startsWith("http") ) {
            textoUrl
= "www." + textoUrl;
       
}        
       
if ( ! textoUrl.startsWith("http") ) {
            textoUrl
= "http://" + textoUrl;
       
}      
       
Navegador.setURL(textoUrl);        
   
}

Carlos Verdier

unread,
May 28, 2014, 9:51:10 AM5/28/14
to codenameone...@googlegroups.com
I think I´ve found a lead.

Building a simple use case, I discovered that placing the web component inside a tab is causing the problem. Sorry I didn´t say anything about that tab but I though that it was irrelevant.

Any way to overcome this problem without removing the tabs? It would be a headache to redesign the whole app because this.

Thank you


On Tuesday, May 27, 2014 4:35:18 PM UTC+2, Chen Fishbein wrote:

Nirmal Juthani

unread,
Jun 2, 2014, 9:33:24 AM6/2/14
to codenameone...@googlegroups.com
Hi,

I recently tested this on a MTV Slash Android Tablet with Android version 4.1.2.

And I am also facing an issue where, the WebBrowser component fails to show the keyboard on subsequent pages. My first page is a login page with two input fields. However when I navigate to say some other page, then after that page whenever I open some new page which requires input then the keyboard fails to open. Even after reload of the current page does not fix this issue.

Also My WebBrowser is not inside a Tab component, it is on a Container with BorderLayout and placed in center.

Thanks,
Nirmal

Nirmal Juthani

unread,
Jun 2, 2014, 9:39:17 AM6/2/14
to codenameone...@googlegroups.com
Also this seems to be inconsistent, on my second try for the same use case - now I am seeing the keyboard opens for subsequent pages.

It seems, in my earlier case when it stopped showing the keyboard was when my app received a notification while the browser was open. And in push notification my app showed a Dialog. It seems, after showing the Dialog, the WebBrowser stopped showing the Keyboard.

May be this could be the issue that after a Dialog is shown, the Keyboard stops appearing.

Thanks,
Nirmal

On Tuesday, May 27, 2014 6:46:46 PM UTC+5:30, Carlos Verdier wrote:

Carlos Verdier

unread,
Jun 2, 2014, 3:38:55 PM6/2/14
to codenameone...@googlegroups.com
I still have this problem too. I´ve managed to get it working in a very simple use case, but it doesn´t work in my app. And it´s not inside a tab now.

I got it working in my tablet, but only after removing the webbrowser and adding it back again programatically. The same thing does not work for my phone. Weird...

Hope we can find a solution.

Nirmal Juthani

unread,
Jun 19, 2014, 9:10:01 AM6/19/14
to codenameone...@googlegroups.com
More update on the issue:

If I add the web browser component on a Form on a borderlayout at the center and there are no other components, then the keyboard is shown.

 However when I add another component in the north of that Form, then the keyboard is not shown.

So it seems, the keyboard is only shown when WebBrowser is the only component in the Form with borderlayout and at the center.

Carlos Verdier

unread,
Jun 19, 2014, 9:29:29 AM6/19/14
to codenameone...@googlegroups.com
Even more: if you drag your finger over the container behind the browser, then everything goes back to normal and the keyboard is shown. So I guess that somehow the peer component takes over. I don´t know if that makes sense, but that´s what I´m experiencing.

I have to say that I add the browser in the beforeShow method, and not in the designer. I understand that this may be a problem...

Shai Almog

unread,
Jun 20, 2014, 12:25:43 AM6/20/14
to codenameone...@googlegroups.com
Adding in the beforeShow shouldn't be a problem. I'm guessing there is some hard to reproduce edge case with the peer component that is triggering this, unfortunately tracking things like this is remarkably difficult.
Reply all
Reply to author
Forward
0 new messages