move To Activity - Android Activity

Android examples for Activity:Activity Jump

Description

move To Activity

Demo Code


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

public class Main {
    public static void moveToActivity(Activity activity, Class targetClass,
            Bundle bundle) {//  ww  w .ja v a2  s. com

        if (activity == null || activity.isFinishing()) {
            return;
        }
        Intent intent = new Intent(activity, targetClass);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        activity.startActivity(intent);
    }

    public static void moveToActivity(Activity activity, Class targetClass) {
        moveToActivity(activity, targetClass, null);
    }
}

Related Tutorials