Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.annotation.SuppressLint;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;

import android.net.Uri;

import android.os.Bundle;

public class Main {
    public static void sendScheme(Fragment context, String url) {
        sendScheme((Fragment) context, url, (Bundle) null, false, 0);
    }

    public static void sendScheme(Context context, String url) {
        sendScheme((Context) context, url, (Bundle) null, false, 0);
    }

    public static void sendScheme(Fragment context, String url, Bundle bundle) {
        sendScheme((Fragment) context, url, bundle, false, 0);
    }

    public static void sendScheme(Context context, String url, Bundle bundle) {
        sendScheme((Context) context, url, bundle, false, 0);
    }

    public static void sendScheme(Fragment context, String url, boolean clearTop) {
        sendScheme((Fragment) context, url, (Bundle) null, clearTop, 0);
    }

    public static void sendScheme(Context context, String url, boolean clearTop) {
        sendScheme((Context) context, url, (Bundle) null, clearTop, 0);
    }

    public static void sendScheme(Fragment context, String url, int flag) {
        sendScheme((Fragment) context, url, (Bundle) null, false, flag);
    }

    public static void sendScheme(Context context, String url, int flag) {
        sendScheme((Context) context, url, (Bundle) null, false, flag);
    }

    @SuppressLint("NewApi")
    public static void sendScheme(Fragment context, String url, Bundle bundle, boolean clearTop, int flag) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
        if (bundle != null) {
            intent.putExtras(bundle);
        }

        if (clearTop) {
            intent.addFlags(67108864);
        }

        if (flag != 0) {
            intent.setFlags(flag);
        }

        context.startActivity(intent);
    }

    public static void sendScheme(Context context, String url, Bundle bundle, boolean clearTop, int flag) {
        Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(url));
        if (bundle != null) {
            intent.putExtras(bundle);
        }

        if (clearTop) {
            intent.addFlags(67108864);
        }

        if (flag != 0) {
            intent.setFlags(flag);
        }

        context.startActivity(intent);
    }
}