Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;

public class Main {
    private static boolean isKnownBrowser(Context context, Intent i) {
        ResolveInfo resolvedActivity = context.getPackageManager().resolveActivity(i,
                PackageManager.MATCH_DEFAULT_ONLY);
        if (resolvedActivity == null) {
            // No browser
            return false;
        }

        String name = resolvedActivity.activityInfo.name;
        if (name == null) {
            return false;
        }

        name = name.toLowerCase();
        return name.contains("chrome") || name.contains("firefox");
    }
}