Example usage for android.app Activity getIntent

List of usage examples for android.app Activity getIntent

Introduction

In this page you can find the example usage for android.app Activity getIntent.

Prototype

public Intent getIntent() 

Source Link

Document

Return the intent that started this activity.

Usage

From source file:Main.java

static boolean isSharedElementTransition(Activity activity) {
    return isSharedElementTransition(activity.getIntent().getExtras());
}

From source file:Main.java

public static void onActivityResult(Activity activity, Intent data) {
    if (data != null) {
        Intent i = activity.getIntent();
        i.putExtra(EXTRA_FORWARD_INTENT, data);
        activity.setResult(0, i);//  ww w  .  jav  a  2 s  .c  o  m
    }
}

From source file:Main.java

public static void restartActivity(Activity activity) {
    activity.finish();
    activity.startActivity(activity.getIntent());
}

From source file:Main.java

/**
 * Used to get the parameter values passed into Activity via a Bundle.
 *
 * @return param Parameter value/*from ww  w . j  a v  a  2  s  .  c om*/
 */
public static String getExtraString(Activity context, String key) {
    String param = "";
    Bundle bundle = context.getIntent().getExtras();
    if (bundle != null) {
        param = bundle.getString(key);
    }
    return param;
}

From source file:Main.java

/**
 * Used to get the parameter values passed into Activity via a Bundle.
 *
 * @param context The current Context or Activity that this method is called from
 * @param key     Extra key name.//from  ww  w.  ja  v  a2  s  . c o m
 * @return param Parameter value
 */
public static Object getExtraObject(Activity context, String key) {
    Object param = null;
    Bundle bundle = context.getIntent().getExtras();
    if (bundle != null) {
        param = bundle.get(key);
    }
    return param;
}

From source file:com.laevatein.internal.misc.ui.FragmentUtils.java

public static <T extends Parcelable> T getIntentParcelableExtra(Fragment fragment, String key) {
    Activity activity = fragment.getActivity();
    Intent intent = activity.getIntent();
    return intent.getParcelableExtra(key);
}

From source file:com.laevatein.internal.misc.ui.FragmentUtils.java

public static boolean getIntentBooleanExtra(Fragment fragment, String key, boolean fallback) {
    Activity activity = fragment.getActivity();
    Intent intent = activity.getIntent();
    return intent.getBooleanExtra(key, fallback);
}

From source file:Main.java

/**
 * Reload activity//  www . ja  v  a2 s.  c o  m
 *
 * @param activity Activity to be reloaded
 */
public static void reloadActivity(Activity activity) {
    // reload activity
    activity.finish();
    activity.startActivity(activity.getIntent());
}

From source file:Main.java

/**
 * Start the original activity, and finish the precondition activity.
 * @param preconditionActivity// w  ww  . j a va 2s  . co m
 */
public static void startOriginalActivityAndFinish(Activity preconditionActivity) {
    preconditionActivity
            .startActivity((Intent) preconditionActivity.getIntent().getParcelableExtra(EXTRA_WRAPPED_INTENT));
    preconditionActivity.finish();
}

From source file:Main.java

public static Object getPendingData(Activity activity, int i) {
    switch (i) {//from w w  w.  j  ava 2s  . c  o m
    case PENDING_STATE_TAKE_PHOTO /*1*/:
        return activity.getIntent().getStringExtra(EXTRA_TAKE_PHOTO);
    case PENDING_STATE_TAKE_VIDEO /*2*/:
        return activity.getIntent().getStringExtra(EXTRA_TAKE_VIDEO);
    default:
        return null;
    }
}