Skip to content

Instantly share code, notes, and snippets.

View sbelloz's full-sized avatar
💻
Focusing

Simone Bellotti sbelloz

💻
Focusing
View GitHub Profile
@sbelloz
sbelloz / CollectionUtils.java
Created April 20, 2016 11:16 — forked from mmarcon/CollectionUtils.java
Maps are not Parcelable and this is an issue in Android when they need to be passed to activities and services via Intents. The corresponding Map-like object in Android is the Bundle. Bundle is a more generic container, it doesn't enforce types via generics and isn't supported natively by JSON deserializers such as Gson. This utility class expos…
package es.cloudey.pagespeed.util;
import java.util.HashMap;
import java.util.Map;
import android.os.Bundle;
import android.os.Parcelable;
public class CollectionUtils {
public static Bundle toBundle(Map<String, ? extends Parcelable> input) {