show Dolphin Browser via Intent - Android Intent

Android examples for Intent:Browser Intent

Description

show Dolphin Browser via Intent

Demo Code


//package com.book2s;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;

import android.content.pm.PackageManager;
import android.net.Uri;

public class Main {

    public static void showDolphinBrowser(Context context, String visitUrl) {

        gotoUrl(context, "mobi.mgeek.TunnyBrowser", visitUrl,
                ((Activity) context).getPackageManager());
    }//  w w w . j av  a2  s  .c o m

    private static void gotoUrl(Context context, String packageName,
            String url, PackageManager packageMgr) {
        try {
            Intent intent;
            intent = packageMgr.getLaunchIntentForPackage(packageName);
            intent.setAction(Intent.ACTION_VIEW);
            intent.addCategory(Intent.CATEGORY_DEFAULT);
            intent.setData(Uri.parse(url));
            context.startActivity(intent);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials