I am trying to set multiple values in hashmap in my android app. Some values are String
and one value I want to send is an array of objects I created OnlineTestResultPOJO
. Following is the code which I want to implement.
OnlineTestResultPOJO[] records = db.resultDao().getRecords();
HashMap<String, String> map = new HashMap<>();
map.put("dbname",dbname);
map.put("class",clas);
map.put("rollno",rollno);
map.put("access_token",accessToken);
map.put("records_arr", records);
Obviously it is giving error in the last line as it is not String
, but is it possible to set all of these things in one HashMap
? I tried wrapping it with String.valueOf(records)
, but that spoils the working of object producing unexpected results. Any alternate solution to achieve this?