Search code examples
androidurishortcut

Android launching specific url with specific browser


Launching a specific browser by icon is done with a ACTION_MAIN. Launching a specific url using default browser is done with a ACTION_VIEW.

What if you want to open a specific url in a specific browser?


Solution

  • If you know the package name and the class name of the browser,you can use Intent.setClassName (String packageName, String className). looks like:

    Intent i=new Intent(ACTION_VIEW, url);
    i.setClassName("com.test.browser","BrowserActivity");
    startActivity(i);