move To Activity For Result - Android android.app

Android examples for android.app:Activity Navigation

Description

move To Activity For Result

Demo Code

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  . j  av a2 s  .c  o  m
        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