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

public static Bundle getBundle(Activity activity) {
    Intent intent = activity.getIntent();
    Bundle bundle = intent.getExtras();//  w  w w  . ja  va2s  .  c o  m
    return bundle;
}

From source file:Main.java

public static <T> T getBundleSerializableExtra(Activity activity, String key) {
    return (T) activity.getIntent().getSerializableExtra(key);
}

From source file:Main.java

private static Bundle getStartExtras(Activity activity) {
    Intent startIntent = activity.getIntent();
    return startIntent.getExtras();
}

From source file:Main.java

public static Bundle getBundleFromIntent(Activity activity, String name) {
    Intent it = activity.getIntent();
    return it.getBundleExtra(name);
}

From source file:Main.java

public static <T extends Serializable> T getFirstParameter(Activity aContext, Class<T> aParameterClass) {
    if (aContext.getIntent() != null && aContext.getIntent().getExtras() != null) {
        return (T) aContext.getIntent().getExtras().get("parameter-0");
    } else {// w ww .j  a  va 2  s  .c  om
        return null;
    }
}

From source file:Main.java

public static <T extends Serializable> T getSecondParameter(Activity aContext, Class<T> aParameterClass) {
    if (aContext.getIntent() != null && aContext.getIntent().getExtras() != null) {
        return (T) aContext.getIntent().getExtras().get("parameter-1");
    } else {//  ww w. j  a v  a 2  s  . c  om
        return null;
    }
}

From source file:Main.java

public static String getInfo(Activity activity) {
    String data = "";

    if (activity.getIntent().hasExtra(SMART_PHONE_PLUGIN_INFO))
        data = activity.getIntent().getStringExtra(SMART_PHONE_PLUGIN_INFO);

    return data;// ww  w . j av a  2  s .co  m
}

From source file:Main.java

static boolean checkForIntentWithAction(Activity activity, String action) {
    Intent intent = activity.getIntent();
    if (intent == null) {
        return false;
    }/*from  w w  w. j a  v  a  2s.c  o m*/
    return TextUtils.equals(intent.getAction(), action);
}

From source file:Main.java

public static Object getParameter(Activity activity, String name) {
    Intent intent = activity.getIntent();
    if (intent == null)
        return null;

    Bundle bundle = intent.getExtras();//from  ww w. ja  v a2s.c  o m
    if (bundle == null)
        return null;

    return bundle.get(name);
}

From source file:Main.java

public static boolean startForwardActivity(Activity activity) {
    try {/*from   w  w w.j a  va  2s  .co m*/
        Intent i = activity.getIntent().getParcelableExtra(EXTRA_FORWARD_INTENT);
        if (i != null) {
            activity.startActivityForResult(i, 0);
            return true;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}