Android examples for Android OS:Bundle Key
Handles the logic of throwing an exception if the throwIfNotPresent is true and the bundle does not contain the key.
//package com.book2s; import android.os.Bundle; public class Main { /**// w ww . j a v a 2 s. co m * Handles the logic of throwing an exception if the throwIfNotPresent is * true and the bundle does not contain the key. * @param bundle * @param key * @param throwIfNotPresent * @return */ protected static void doThrowHelper(Bundle bundle, String key, boolean throwIfNotPresent) { if (throwIfNotPresent && !bundle.containsKey(key)) { throw new IllegalArgumentException("bundle does not contain: " + key); } } }