jump to Activity by Class - Android Activity

Android examples for Activity:Activity Jump

Description

jump to Activity by Class

Demo Code


//package com.java2s;
import android.content.Context;
import android.content.Intent;

public class Main {
    public static void jump1(Context context, Class clazz, String key,
            String value) {// w w w  .  j a va2  s.  c  o m
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClass(context, clazz);
        intent.putExtra(key, value);
        context.startActivity(intent);

    }

    public static void jump1(Context context, Class clazz, String key,
            String value, String key2, String value2) {
        Intent intent = new Intent();
        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        intent.setClass(context, clazz);
        intent.putExtra(key, value);
        intent.putExtra(key2, value2);
        context.startActivity(intent);

    }
}

Related Tutorials