Example usage for android.os Bundle getBundle

List of usage examples for android.os Bundle getBundle

Introduction

In this page you can find the example usage for android.os Bundle getBundle.

Prototype

@Nullable
public Bundle getBundle(@Nullable String key) 

Source Link

Document

Returns the value associated with the given key, or null if no mapping of the desired type exists for the given key or a null value is explicitly associated with the key.

Usage

From source file:Main.java

public static Bundle maybeGetBundle(final @Nullable Bundle state, final @NonNull String key) {
    if (state == null) {
        return null;
    }/*from  w w  w . j  a v  a2 s.c o  m*/

    return state.getBundle(key);
}

From source file:Main.java

public static boolean isUninstallTrackingPush(Bundle bundle) {
    if (bundle != null) {
        if (bundle.containsKey("appboy_uninstall_tracking")) {
            return true;
        }/*w w  w .  j ava2 s . com*/
        bundle = bundle.getBundle("extra");
        if (bundle != null) {
            return bundle.containsKey("appboy_uninstall_tracking");
        }
    }
    return false;
}

From source file:org.klnusbaum.udj.containers.Player.java

public static Player unbundle(Bundle toUnbundle) {
    return new Player(toUnbundle.getString(ID_PARAM), toUnbundle.getString(NAME_PARAM),
            User.unbundle(toUnbundle.getBundle(OWNER_PARAM)), toUnbundle.getDouble(LATITUDE_PARAM),
            toUnbundle.getDouble(LONGITUDE_PARAM), toUnbundle.getBoolean(HAS_PASSWORD_PARAM));
}

From source file:com.google.android.apps.muzei.api.internal.SourceState.java

public static SourceState fromBundle(Bundle bundle) {
    SourceState state = new SourceState();
    Bundle artworkBundle = bundle.getBundle("currentArtwork");
    if (artworkBundle != null) {
        state.mCurrentArtwork = Artwork.fromBundle(artworkBundle);
    }/*from  w  w w. j  a v a 2  s . c  o  m*/
    state.mDescription = bundle.getString("description");
    state.mWantsNetworkAvailable = bundle.getBoolean("wantsNetworkAvailable");
    String[] commandsSerialized = bundle.getStringArray("userCommands");
    if (commandsSerialized != null && commandsSerialized.length > 0) {
        for (String s : commandsSerialized) {
            state.mUserCommands.add(UserCommand.deserialize(s));
        }
    }
    return state;
}

From source file:org.opensilk.music.library.LibraryConfig.java

public static LibraryConfig materialize(Bundle b) {
    return new LibraryConfig(b.getInt("_1"), b.getInt("_2"), b.<ComponentName>getParcelable("_3"),
            b.getBundle("_4"), b.getString("_5"));
}

From source file:org.peercast.core.Channel.java

/**
 * nativeGetChannels??wrap???//from w w  w  .j a va 2  s  . c o  m
 *
 * @see PeerCastService#nativeGetChannels()
 */
public static List<Channel> fromNativeResult(Bundle bChannels) {
    List<Channel> channels = new ArrayList<>();

    while (bChannels != null && !bChannels.isEmpty()) {
        //Log.d("Channel.java", ""+bChannel);
        channels.add(new Channel(bChannels));
        bChannels = bChannels.getBundle("next");
    }
    return channels;
}

From source file:org.chromium.chrome.browser.util.IntentUtils.java

/**
 * Just like {@link Bundle#getBundle(String)} but doesn't throw exceptions.
 *//*from  w w  w .  j  ava2 s.  com*/
public static Bundle safeGetBundle(Bundle bundle, String name) {
    try {
        return bundle.getBundle(name);
    } catch (Throwable t) {
        // Catches un-parceling exceptions.
        Log.e(TAG, "getBundle failed on bundle " + bundle);
        return null;
    }
}

From source file:android.support.car.ui.CarNavExtender.java

/**
 * Static version of {@link #isExtended()}.
 *///from  w  ww  .  java  2  s.  co  m
public static boolean isExtended(Notification notification) {
    Bundle extras = NotificationCompat.getExtras(notification);
    if (extras == null) {
        return false;
    }

    extras = extras.getBundle(EXTRA_CAR_EXTENDER);
    return extras != null && extras.getBoolean(EXTRA_IS_EXTENDED);
}

From source file:android.support.car.ui.CarNavExtender.java

/**
 * @return The type without having to construct an entire {@link CarNavExtender} object.
 *//*  www  .  ja  v a  2s . c o  m*/
@Type
public static int getType(Notification notification) {
    Bundle extras = NotificationCompat.getExtras(notification);
    if (extras == null) {
        return TYPE_NORMAL;
    }
    Bundle b = extras.getBundle(EXTRA_CAR_EXTENDER);
    if (b == null) {
        return TYPE_NORMAL;
    }

    // The ternary guarantees that we return either TYPE_HERO or TYPE_NORMAL.
    return (b.getInt(EXTRA_TYPE, TYPE_NORMAL) == TYPE_HERO) ? TYPE_HERO : TYPE_NORMAL;
}

From source file:com.sonyericsson.android.drm.drmlicenseservice.DLSHttpClient.java

private static void addParameters(Bundle parameters, HttpRequestBase request) {
    if (parameters != null && request != null) {
        Bundle headers = parameters.getBundle(Constants.DRM_KEYPARAM_HTTP_HEADERS);
        if (headers != null && headers.size() > 0) {
            for (String headerKey : headers.keySet()) {
                if (headerKey != null && headerKey.length() > 0) {
                    String headerValue = headers.getString(headerKey);
                    if (headerValue != null && headerValue.length() > 0) {
                        request.setHeader(headerKey, headerValue);
                    }//from   w ww . ja va2 s  .c  om
                }
            }
        }
    }
}