launch External Browser - Android android.content

Android examples for android.content:Intent

Description

launch External Browser

Demo Code

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main{

    public static void launchExternalBrowser(final Context context,
            final Uri uri) {
        new Thread(new Runnable() {
            @Override/*w  w  w .  ja v  a2  s  .  co  m*/
            public void run() {
                Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                context.startActivity(intent);
            }
        }).start();
    }

}

Related Tutorials