Convert Bundle To Map - Android android.os

Android examples for android.os:Bundle

Description

Convert Bundle To Map

Demo Code

import android.os.Bundle;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

public class Main{

    public static Map<String, Serializable> bundleToMap(Bundle bundle) {
        Map<String, Serializable> result = new HashMap<String, Serializable>();
        if (bundle == null)
            return result;

        for (String key : bundle.keySet()) {
            result.put(key, bundle.getSerializable(key));
        }// ww  w . j  a  v  a 2s . c  om
        return result;
    }

}

Related Tutorials