get String Array List from Bundle - Android Android OS

Android examples for Android OS:Bundle Get

Description

get String Array List 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 ArrayList<String> getStringArrayList(String key,
            Bundle... bundles) {//from ww  w . j a  v a2 s .c  o  m
        if (bundles != null) {
            for (Bundle bundle : bundles) {
                if (bundle != null && bundle.containsKey(key)) {
                    return bundle.getStringArrayList(key);
                }
            }
        }
        MTLog.d(TAG,
                "Can't find the string array list value for key '%s' (returned null)",
                key);
        return null;
    }
}

Related Tutorials