URL opening problem.

160 views
Skip to first unread message

Armen Nalbandyan

unread,
Oct 14, 2013, 8:27:33 AM10/14/13
to codenameone...@googlegroups.com
I wont to open link with device default browser .I write this code but it is showing in android execution time "loading please wait" progress after it nothing happened.Please help me to fix it.

 protected static void execute(String url) {
                if(BrowserComponent.isNativeBrowserSupported()) {
                        BrowserComponent browser = new BrowserComponent();
                        browser.setURL(url);
                }
                else {
                        Display.getInstance().execute(url);
                }
        }

Chen Fishbein

unread,
Oct 14, 2013, 9:11:23 AM10/14/13
to codenameone...@googlegroups.com
why are you using BrowserComponent if you want to use the device browser?

do this:

 protected static void execute(String url) {
                        Display.getInstance().execute(url);
}


The BrowserComponent is useful to show a web view inside a cn1 Form.

OMAROMAN

unread,
Jan 29, 2014, 4:11:34 PM1/29/14
to codenameone...@googlegroups.com
I have a similar problem, I want to open a URL in the device default web browser using the method:

Display.getInstance().execute(url);

In the simulator it indeed opens the url in the default web browser, but in a real device it does nothing.

I tested in Nexus One (Android ver. 2.3.6) and Galaxy Tab 3 (Android ver. 4.2.2). It does not work in any.

Shai Almog

unread,
Jan 30, 2014, 1:47:31 AM1/30/14
to codenameone...@googlegroups.com
This works for us consistently and we have quite a few devices including the nexus one. What's the URL you are trying to open? Is it an http/https URL?

OMAROMAN

unread,
Jan 30, 2014, 1:39:36 PM1/30/14
to codenameone...@googlegroups.com
Thanks Shai, 

The protocol (http) was missing in the URL.
Reply all
Reply to author
Forward
0 new messages