Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;

import android.content.Intent;

import android.net.Uri;

public class Main {
    /**
     * Opens the device's browser to the passed url
     * @param activity the calling activity
     * @param url the url to view
     */
    public static void openBrowser(Activity activity, String url) {
        final Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        activity.startActivity(Intent.createChooser(browserIntent, null));
    }
}