loading...

Multiple types of HashMap parameters through Ajax in Android Studio

rlogical profile image Rlogical Techsoft Pvt Ltd ・1 min read

f you are initializing HashMap with fixed data type then you can not store any other values for that other then specified datatype. If you want to store any data as a value then you should use Object data type.

HashMap param = new HashMap<>();
Then after you can add any value (Bitmap or String) as a Map value.

You can store the value like,

HashMap param = new HashMap<>();
param.put("listing_title", ETitle.getText().toString()); // String values
// add Other String parameters here..
param.put("listing_img_file", bitmap); // Your Image Bitmap file
My suggestion is replace your HashMap with LinkedHashMap. HashMap doesn't maintain any order while LinkedHashMap maintains insertion order of elements.

Know more here: https://stackoverflow.com/questions/55881005/is-there-a-way-to-send-multiple-types-of-hashmap-parameters-through-ajax-in-andr/55881344#55881344

Discussion

markdown guide