Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.content.Context;
import android.content.Intent;

import android.net.Uri;

import android.util.Log;

public class Main {
    public static boolean jump(Context context, String s) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(s));
        boolean flag;
        if (!isIntentAvailable(context, intent)) {
            Log.e("MicroMsg.Util", (new StringBuilder("jump to url failed, ")).append(s).toString());
            flag = false;
        } else {
            context.startActivity(intent);
            flag = true;
        }
        return flag;
    }

    public static boolean isIntentAvailable(Context context, Intent intent) {
        boolean flag;
        if (context.getPackageManager().queryIntentActivities(intent, 0x10000).size() > 0)
            flag = true;
        else
            flag = false;
        return flag;
    }
}