start Activity For Result - Android Activity

Android examples for Activity:Activity Start

Description

start Activity For Result

Demo Code


import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;

public class Main{
    public static final String FRAGMENT_ARGS = "fragment_arg";
    public static final String FRAGMENT_NAME = "fragment_name";
    public static final String FRAGMENT_TAG = "fragment_tag";
    public static void startActivityForResult(Fragment host, Fragment target) {
        Intent intent = new Intent(host.getActivity(), BaseActivity.class);
        Bundle bundle = new Bundle();
        bundle.putString(FRAGMENT_NAME, target.getClass().getName());
        bundle.putString(FRAGMENT_TAG, target.getClass().getName());
        bundle.putBundle(FRAGMENT_ARGS, target.getArguments());
        intent.putExtras(bundle);/*  ww w  . j a v a  2s.  c  om*/
        //      host.startActivityForResult(intent, MainActivityHelper.REQUEST_CODE_COUPON);
    }
}

Related Tutorials