Android examples for android.os:Parcel
Read a HashMap from a Parcel, class of key and value are both String
//package com.java2s; import java.util.HashMap; import java.util.Map; import android.os.Parcel; public class Main { /**/*from ww w.ja v a 2 s.c o m*/ * Read a HashMap from a Parcel, class of key and value are both String * * @param in * @return */ public static Map<String, String> readHashMapStringAndString(Parcel in) { if (in == null) { return null; } int size = in.readInt(); if (size == -1) { return null; } Map<String, String> map = new HashMap<String, String>(); for (int i = 0; i < size; i++) { String key = in.readString(); map.put(key, in.readString()); } return map; } }