Example usage for android.os Bundle containsKey

List of usage examples for android.os Bundle containsKey

Introduction

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

Prototype

public boolean containsKey(String key) 

Source Link

Document

Returns true if the given key is contained in the mapping of this Bundle.

Usage

From source file:Main.java

public static boolean contains(Bundle bundle, String key) {
    return (bundle != null && bundle.containsKey(key));
}

From source file:Main.java

public static boolean hasKey(Bundle bundle, String key) {
    return (bundle != null && bundle.containsKey(key));
}

From source file:Main.java

public static boolean isUninstallTrackingPush(Bundle bundle) {
    if (bundle != null) {
        if (bundle.containsKey("appboy_uninstall_tracking")) {
            return true;
        }//from   w  w  w  . ja v a 2s .co m
        bundle = bundle.getBundle("extra");
        if (bundle != null) {
            return bundle.containsKey("appboy_uninstall_tracking");
        }
    }
    return false;
}

From source file:Main.java

public static int countIndexes(Bundle bundle, String baseKey) {
    int count = 0;
    while (bundle.containsKey(baseKey + count))
        count++;//from ww  w  . j  a  v a  2 s.c o m
    return count;
}

From source file:Main.java

public static Boolean getBoolean(Bundle arguments, String key) {
    if (arguments != null && arguments.containsKey(key)) {
        return arguments.getBoolean(key);
    } else {/*from   w  ww  .  j av  a 2s . c om*/
        return null;
    }
}

From source file:Main.java

public static boolean bundleContains(Bundle bundle, Class<? extends Serializable> aClass) {
    return bundle != null && bundle.containsKey(aClass.getCanonicalName());
}

From source file:Main.java

/**
 * Test is the bundle contains the information of small parcel of a whole message.<br>
 * /*from  w  ww.j a  va2s. co  m*/
 * @param dataBundle, Bundle, get from the data property of a Message object.
 * @return boolean, true, if the dataBundle contains the information of small parcel.
 * @see #setBundleOfSmallParcel(String, int, int)
 * @see #getParcelableIDFromSmallParcel(Parcelable)
 * @see #getParcelableIndexFromSmallParcel(Parcelable)
 * @see #getParcelableTotalNumberFromSmallParcel(Parcelable)
 */
public static boolean isSmallParcelOfWholeMessage(Bundle dataBundle) {
    return (dataBundle != null && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_ID)
            && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_INDEX)
            && dataBundle.containsKey(BUNDLE_SMALL_PARCEL_TOTALNUMBER));
}

From source file:Main.java

public static Object getBundleArg(Bundle extras, String argumentKey) {
    if (extras == null) {
        return null;
    }/*ww w .ja  va2s.c  o m*/
    if (!extras.containsKey(argumentKey))
        return null;
    return extras.get(argumentKey);

}

From source file:Main.java

public static boolean containsAll(Bundle bundle, String... keys) {

    if (bundle == null)
        return false;

    for (String key : keys) {
        if (!bundle.containsKey(key))
            return false;
    }//  w ww. j a v a 2  s.c o m
    return true;
}

From source file:com.airbnb.deeplinkdispatch.sample.MainActivity.java

@DeepLink("http://example.com/deepLink/{id}/{name}/{place}")
public static TaskStackBuilder intentForTaskStackBuilderMethods(Context context, Bundle bundle) {
    Log.d(TAG, "without query parameter :");
    if (bundle != null && bundle.containsKey("qp")) {
        Log.d(TAG, "found new parameter :with query parameter :" + bundle.getString("qp"));
    }//from  ww w. j  a  v a  2s  .  c  o m
    Intent detailsIntent = new Intent(context, SecondActivity.class).setAction(ACTION_DEEP_LINK_COMPLEX);
    Intent parentIntent = new Intent(context, MainActivity.class).setAction(ACTION_DEEP_LINK_COMPLEX);
    TaskStackBuilder taskStackBuilder = TaskStackBuilder.create(context);
    taskStackBuilder.addNextIntent(parentIntent);
    taskStackBuilder.addNextIntent(detailsIntent);
    return taskStackBuilder;

}