get String Array from Bundle - Android Android OS

Android examples for Android OS:Bundle Get

Description

get String Array from Bundle

Demo Code


import java.util.ArrayList;
import android.os.Bundle;
import android.os.Parcelable;

public class Main{
    private static final String TAG = BundleUtils.class.getSimpleName();
    public static String[] getStringArray(String key, Bundle... bundles) {
        if (bundles != null) {
            for (Bundle bundle : bundles) {
                if (bundle != null && bundle.containsKey(key)) {
                    return bundle.getStringArray(key);
                }/*from  w  w  w. j a v  a 2 s.co m*/
            }
        }
        MTLog.d(TAG,
                "Can't find the string array value for key '%s' (returned null)",
                key);
        return null;
    }
}

Related Tutorials