get String value from Bundle by key with default value - Android android.os

Android examples for android.os:Bundle

Description

get String value from Bundle by key with default value

Demo Code

import android.os.Bundle;

public class Main{

    public static String getString(Bundle bundle, String key,
            String defaultValue) {
        if (bundle == null || Strings.isEmpty(key)) {
            return defaultValue;
        }// w  w  w .  j a va  2 s .  c  o m
        return bundle.getString(key, defaultValue);
    }
}

Related Tutorials