1. Are you ready for the Galaxy S20? Here is everything we know so far!

Launch browser with no specific URL?

Discussion in 'Android Development' started by cr5315, Dec 29, 2011.

  1. cr5315

    cr5315 Android Enthusiast
    Thread Starter

    I'm trying to find a method to launch whatever browser a user has, but to no specific link. I've been looking all over but I haven't found anything that works. My latest attempt was with this code:
    Code (Text):
    1. String packageName = "com.android.browser";
    2. String className = "com.android.browser.BrowserActivity";
    3. Intent internetIntent = new Intent(Intent.ACTION_VIEW);
    4. internetIntent.addCategory(Intent.CATEGORY_LAUNCHER);
    5. internetIntent.setClassName(packageName, className);
    6. startActivity(internetIntent);
    As I was copying and pasting that, I just realized that it would launch the stock browser if it worked, so that's not what I want.

    Anyone have any ideas on how to launch a browser with no URL?

    1. Download the Forums for Android™ app!



Share This Page