get String from a list of Bundle - Android Android OS

Android examples for Android OS:Bundle Get

Description

get String from a list of 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 getString(String key, Bundle... bundles) {
        if (bundles != null) {
            for (Bundle bundle : bundles) {
                if (bundle != null && bundle.containsKey(key)) {
                    return bundle.getString(key);
                }/*from  www  .jav a2  s.c  om*/
            }
        }
        MTLog.d(TAG,
                "Can't find the string value for key '%s' (returned null)",
                key);
        return null;
    }
}

Related Tutorials