Android examples for android.os:Bundle
get Long value from Bundle by key and handle null value
import android.os.Bundle; public class Main { /**/*from w w w . jav a 2 s . com*/ * get Long * * @param bundle * @param key * @return */ public static Long getLong(Bundle bundle, String key) { if (isEmpty(bundle, key)) { return null; } else { return bundle.getLong(key); } } /** * check whether a key is empty * * @param bundle * @param key * @return */ public static boolean isEmpty(Bundle bundle, String key) { return bundle == null || !bundle.containsKey(key); } }