Question: I have a HashMap(String,HashMap(String,Object)) in one of my activity. How do I send this HashMap to another activity via intents

How to add this HashMap to intent extras?

Answer: 
Sending HashMap

```
HashMap<String, Object> hashmapobject =new HashMap<>();
HashMap<String, Object> newhashMap=new HashMap<>();
hashmapobject.put("key",newhashMap);

Intent intent = new Intent(SenderActivity.this, NextActivity.class);
intent.putExtra("hashMapKey", hashmapobject);
startActivity(intent);

```

Receiving HashMap

```
Intent intent = getIntent();    
HashMap<String, Object> hashMapObject = (HashMap<String, Object>)       intent.getSerializableExtra("hashMapKey");
HashMap<String, Object> newhashMap=(HashMap<String, Object>)hashMapObject.get("key");

```
There could be multiple approaches to your problem and each one depends on what datatype you are storing in `map`. Easiest approach is to use JSONObject from json.org pass it as String and while receiving convert it back to JSON. JSONObject uses a LinkedHashMap inside thus you will be able to use the features of `HashMap`.

```
JSONObject obj=new JSONObject();
obj.put("key1", "value1");
obj.put("key2", "value2");
obj.put("key3", "value3");
.
.
.
obj.put("keyN", "valueN");

intent.putExtra("map", obj.toString());

```

While receiving 

```
JSONObject obj=new JSONObject(getIntent().getStringExtra("map"));

```

For complex datatypes try considering either JSON Libraries like GSON or use Parcelable interface.