Example usage for android.content Intent getExtras

List of usage examples for android.content Intent getExtras

Introduction

In this page you can find the example usage for android.content Intent getExtras.

Prototype

public @Nullable Bundle getExtras() 

Source Link

Document

Retrieves a map of extended data from the intent.

Usage

From source file:Main.java

static boolean isSharedElementTransition(Intent intent) {
    return isSharedElementTransition(intent.getExtras());
}

From source file:Main.java

public static void setImageToImageView(Context context, Intent intent, ImageView imageView) {
    Bundle extras = intent.getExtras();
    if (extras != null) {
        photo = extras.getParcelable("data");
        imageView.setImageBitmap(photo);
    }/*  w  w w .j a va2  s .  com*/
}

From source file:Main.java

/**
 * Gets the service./* w  ww . j a v  a2 s  .  co  m*/
 * 
 * @param intent
 *            the intent
 * 
 * @return the service
 */
public static ComponentName getService(Intent intent) {
    String name = intent.getExtras().getString(SERVICE_KEY);
    if (name == null)
        return null;
    return ComponentName.unflattenFromString(name);
}

From source file:Main.java

public static void setPicToView(Intent picdata, ImageView imageView) {
    Bundle extras = picdata.getExtras();
    if (extras != null) {
        Bitmap photo = extras.getParcelable("data");
        imageView.setImageBitmap(photo);
    }//from w w w.  j a  v  a  2 s . co m

}

From source file:Main.java

public static Bundle copyExtras(Intent i) {
    Bundle copy = new Bundle();
    Bundle original = i.getExtras();
    if (original != null) {
        copy.putAll(original);/*from w w w.ja  v a  2  s. com*/
    }
    return copy;

}

From source file:Main.java

public static void printExtras(Intent i) {
    if (i == null) {
        return;/*from www.ja  va2s  .  c o m*/
    }
    Bundle bundle = i.getExtras();
    if (bundle == null) {
        return;
    }
    Log.d("INTENT_EXTRAS", "++++ Printing extras: +++");
    for (String key : bundle.keySet()) {
        Object value = bundle.get(key);
        Log.d("INTENT_EXTRAS", String.format("%s %s (%s)", key, value.toString(), value.getClass().getName()));
    }
}

From source file:Main.java

public static void dumpBatteryStats(Context context) {
    IntentFilter ifilter = new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
    Intent batteryStatus = context.registerReceiver(null, ifilter);

    Bundle bundle = batteryStatus.getExtras();
    for (String key : bundle.keySet()) {
        Object value = bundle.get(key);
        Log.d(TAG, String.format("Battery,%s=%s (%s)", key, value.toString(), value.getClass().getName()));
    }/*from w w w .  j  a  va  2  s . co  m*/
}

From source file:Main.java

public static String getActiviteitNameFromIntent(Intent intent) {
    if (intent == null) {
        return null;
    }/*from ww  w  .ja va 2  s  . c o  m*/
    Bundle extras = intent.getExtras();
    if (extras == null) {
        return null;
    }
    return extras.getString(ACTIVITEIT_NAME);
}

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();
    if (bundle == null)
        return null;

    return bundle.get(name);
}

From source file:Main.java

public static void addTaintInformationToIntent(Intent i, HashSet<String> taintCategories) {
    boolean intentHasNoExtras = i.getExtras() == null ? true : false;

    //A bit of limitation here, because we do only care about the extras
    if (!intentHasNoExtras) {
        Bundle extras = i.getExtras();/* w  ww.  ja  v  a2s.  co m*/

        String taintKeyName = generateKeyNameForTaintInfo(extras.keySet());

        String taintInformation = null;

        if (taintCategories.size() > 1)
            taintInformation = taintCategories.toString().substring(1, taintCategories.toString().length() - 1);
        else
            taintInformation = taintCategories.iterator().next();

        i.putExtra(taintKeyName, taintInformation);
    }
}