@TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static String optString(@Nullable Bundle bundle, @Nullable String key, @Nullable String fallback) {
        if (bundle == null) {
            return fallback;
        }
        return bundle.getString(key, fallback);
    }
@ TargetApi ( Build . VERSION_CODES . LOLLIPOP ) public static String optString ( @ Nullable Bundle bundle , @ Nullable String key , @ Nullable String fallback ) { if ( bundle == null ) { return fallback ; } return bundle . getString ( key , fallback ) ; }
Returns a optional {@link java.lang.String} value. In other words, returns the value mapped by key if it exists and is a {@link java.lang.String}.
The bundle argument is allowed to be {@code null}. If the bundle is null, this method returns a fallback value.
@param bundle a bundle. If the bundle is null, this method will return a fallback value.
@param key a key for the value.
@param fallback fallback value.
@return a {@link java.lang.String} value if exists, fallback value otherwise.
@see android.os.Bundle#getString(String, String)