工具类
public class SerializableMap implements Serializable {
private HashMap<Integer, Boolean> map;
public HashMap<Integer, Boolean> getMap() {
return map;
}
public void setMap(HashMap<Integer, Boolean> map) {
this.map = map;
}
}
使用
//需要传递的map
HashMap<Integer, Boolean> xbksmap = new HashMap<Integer, Boolean>();
Intent intent1 = new Intent(DetailNotifiActivity2.this, XbksAlertActivity.class);
intent1.putExtra("flowname", flowname);
Log.i("gjw", "协办科室被点击");
//传递map
Bundle bundle1 = new Bundle();
SerializableMap tepmap1 = new SerializableMap();
tepmap1.setMap(xbksmap);
bundle1.putSerializable("tepmap", tepmap1);
接收map
HashMap<Integer, Boolean> isSelected= new HashMap<Integer, Boolean>();
HashMap<Integer, Boolean> tempIsSelected= new HashMap<Integer, Boolean>();
Intent intent = getIntent();
Bundle bundle = getIntent().getExtras();
SerializableMap serializableMap = (SerializableMap) bundle.get("tepmap");
//两个map相互赋值
isSelected = serializableMap.getMap();
isSelected.putAll(tempIsSelected);