jump To New Activity - Android Activity

Android examples for Activity:Activity Jump

Description

jump To New Activity

Demo Code


//package com.java2s;
import android.app.Activity;

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

public class Main {
    public static void jumpToNewActivity(Context context,
            Class<? extends Activity> targetClass) {
        Intent datatIntent = new Intent(context, targetClass);
        datatIntent.setFlags(1234);/*  w w w .j  av  a2s .  co m*/
        context.startActivity(datatIntent);
    }

    public static void jumpToNewActivity(Context context,
            Class<? extends Activity> targetClass, String... datas) {
        Intent datatIntent = new Intent(context, targetClass);
        datatIntent.setFlags(1234);
        if (datas != null) {
            for (int i = 0; i < datas.length; ++i) {
                datatIntent.putExtra("data" + i, datas[i]);
            }
        }

        context.startActivity(datatIntent);
    }
}

Related Tutorials