start Activity For Result via various parameters - Android Activity

Android examples for Activity:Activity Start

Description

start Activity For Result via various parameters

Demo Code


//package com.java2s;
import android.app.Activity;

import android.content.Intent;
import android.os.Bundle;

public class Main {
    public static void startActivityForResult(Activity fromActivity,
            Class<? extends Activity> toklass, int requestCode) {
        Intent intent = new Intent(fromActivity, toklass);
        fromActivity.startActivityForResult(intent, requestCode);
    }/*from  w w  w . j  a  va  2 s. c om*/

    public static void startActivityForResult(Activity fromActivity,
            Class<? extends Activity> toklass, int requestCode,
            int enterAnim, int exitAnim) {
        Intent intent = new Intent(fromActivity, toklass);
        fromActivity.startActivityForResult(intent, requestCode);
        fromActivity.overridePendingTransition(enterAnim, exitAnim);
    }

    public static void startActivityForResult(Activity fromActivity,
            Class<? extends Activity> toklass, int requestCode,
            Bundle extras) {
        Intent intent = new Intent(fromActivity, toklass);
        intent.putExtras(extras);
        fromActivity.startActivityForResult(intent, requestCode);
    }

    public static void startActivityForResult(Activity fromActivity,
            Class<? extends Activity> toklass, int requestCode,
            Bundle extras, int enterAnim, int exitAnim) {
        Intent intent = new Intent(fromActivity, toklass);
        intent.putExtras(extras);
        fromActivity.startActivityForResult(intent, requestCode);
        fromActivity.overridePendingTransition(enterAnim, exitAnim);
    }
}

Related Tutorials