move To Activity For Result - Android Activity

Android examples for Activity:Activity Jump

Description

move To Activity For Result

Demo Code


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

public class Main {
    public static void moveToActivityForResult(Activity activity,
            Class targetClass, int requestCode, Bundle bundle) {
        if (activity == null || activity.isFinishing()) {
            return;
        }//from  w  w w.  jav a2  s.com
        Intent intent = new Intent(activity, targetClass);
        if (bundle != null) {
            intent.putExtras(bundle);
        }
        activity.startActivityForResult(intent, requestCode);
    }

    public static void moveToActivityForResult(Activity activity,
            Class targetClass, int resultCode) {
        moveToActivityForResult(activity, targetClass, resultCode, null);
    }
}

Related Tutorials