Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class Main {

    public static void actionStart(Activity activity, Class cls) {
        actionStart(activity, cls, (int[]) null);
    }

    public static void actionStart(Activity activity, Class cls, int... intentFlags) {
        actionStart(activity, cls, null, intentFlags);
    }

    public static void actionStart(Activity activity, Class cls, Bundle bundle) {
        actionStart(activity, cls, bundle, 0);
    }

    public static void actionStart(Activity activity, Class cls, Bundle bundle, int... intentFlags) {
        Intent intent = new Intent(activity, cls);
        if (intentFlags != null) {
            for (int i = 0; i < intentFlags.length; i++) {
                if (intentFlags[i] != 0) {
                    if (i == 0) {
                        intent.setFlags(intentFlags[i]);
                    } else {
                        intent.addFlags(intentFlags[i]);
                    }
                }
            }
        }
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        activity.startActivity(intent);
    }
}