java - Passing custom HashMap between activities in Android -


i have hashmap takes in string id(id of chatroom) key , stores chats specific room in arraylist follow:

    hashmap<string, arraylist<chatmessage>> chathistoryhashmap = new hashmap<string, arraylist<chatmessage>>(); 

this created in roomactivity , want pass chatactivity. how able this? tried make public static using "put" method in chatactivity seems nothing, not sure why.

i need hashmap passed roomactivity when button pressed in chatactivity.

do need use intents?

when made static in class variable visible classes in package cannot happen not able value in activity.

to access static variable can either make th object of class or can directly access using function name.

you can pass object using intent.putextra() , intent.getextra()


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -