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:com.smartnsoft.droid4me.app.ActivityController.java

/**
 * Attempts to decode from the provided {@code activity} the original {@code Intent} that was
 * /*  ww w .java 2  s . c  om*/
 * @param activity
 *          the Activity whose Intent will be analyzed
 * @return an Intent that may be {@link Activity#startActivity(Intent) started} if the provided {@code activity} actually contains a reference to
 *         another {@link Activity} ; {@code null} otherwise
 * @see ActivityController#CALLING_INTENT
 * @see #needsRedirection(Activity)
 * @see #registerInterceptor(ActivityController. Interceptor)
 */
public static Intent extractCallingIntent(Activity activity) {
    return activity.getIntent().getParcelableExtra(ActivityController.CALLING_INTENT);
}

From source file:com.android.settings.util.Helpers2.java

/**
 * Restart the activity smoothly//ww  w . j a  va2 s . c o  m
 *
 * @param activity
 */
public static void restartPC(final Activity activity) {
    if (activity == null)
        return;
    final int enter_anim = android.R.anim.fade_in;
    final int exit_anim = android.R.anim.fade_out;
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.finish();
    activity.overridePendingTransition(enter_anim, exit_anim);
    activity.startActivity(activity.getIntent());
}

From source file:io.github.hidroh.materialistic.AppUtils.java

public static void restart(Activity activity, boolean transition) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        activity.recreate();/* ww  w  .j  av a  2  s  .  co m*/
    } else {
        activity.finish();
        if (transition) {
            activity.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
        }
        activity.startActivity(activity.getIntent());
    }
}

From source file:dentex.youtube.downloader.utils.Utils.java

public static void reload(Activity activity) {
    //finish/*from   ww w.  j  a  v  a 2 s  . co m*/
    activity.finish();
    activity.overridePendingTransition(0, 0);

    //start
    Intent intent = activity.getIntent();
    intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
    activity.startActivity(intent);
    activity.overridePendingTransition(0, 0);
}

From source file:com.schedjoules.eventdiscovery.framework.serialization.commons.Argument.java

public Argument(Key<T> key, Activity activity) {
    this(key, activity.getIntent());
}

From source file:com.schedjoules.eventdiscovery.framework.serialization.commons.OptionalArgument.java

public OptionalArgument(Key<T> key, Activity activity) {
    this(key, activity.getIntent());
}

From source file:io.nuclei.box.intent.AbstractBinding.java

public T toModel(android.support.v4.app.Fragment fragment) {
    if (fragment == null)
        return null;
    Bundle bundle = fragment.getArguments();
    if (bundle == null && fragment.getActivity() != null) {
        Activity activity = fragment.getActivity();
        if (activity.getIntent() != null)
            bundle = activity.getIntent().getExtras();
    }//from w w  w . ja  v a 2  s  .  c o  m
    return toModel(bundle);
}

From source file:io.nuclei.box.intent.AbstractBinding.java

@TargetApi(11)
public T toModel(android.app.Fragment fragment) {
    if (fragment == null)
        return null;
    Bundle bundle = fragment.getArguments();
    if (bundle == null && fragment.getActivity() != null) {
        Activity activity = fragment.getActivity();
        if (activity.getIntent() != null)
            bundle = activity.getIntent().getExtras();
    }//from   w  ww. j av a  2s.  co  m
    return toModel(bundle);
}

From source file:io.nuclei.box.intent.AbstractBinding.java

public T toModel(Activity activity) {
    if (activity != null) {
        Intent intent = activity.getIntent();
        if (intent != null)
            return toModel(intent.getExtras());
    }//from  w ww  .  j a  v a2s .c  om
    return null;
}

From source file:com.it.xushuai.baseapp.fragment.BaseFragment.java

/**
 * Get string extra from activity's intent
 *
 * @param name//from w w  w .  j a  v  a2s.c  om
 * @return extra
 */
protected String getStringExtra(final String name) {
    Activity activity = getActivity();
    if (activity != null)
        return activity.getIntent().getStringExtra(name);
    else
        return null;
}