Iam storing my complex object by converting it to json using GSON in a shared preferences. But while retrieving it, not able to get the expected string.
CODE
Here holderListCustomizationMap is complex map of objects.
Setting shared preferences:
Gson gson = builder.create();
SharedPreferences sh=getSharedPreferences("MYFILE",Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sh.edit();
String json = gson.toJson(holderListCustomizationMap);
editor.putString("Holder",json);
editor.apply();
While storing, json prints out to be the whole expected string.
Retrieving my map from shared preferences:
SharedPreferences sh = context.getSharedPreferences("MYFILE", Context.MODE_PRIVATE);
String listCutomizatoinJson = sh.getString("Holder","");
when i print listCutomizatoinJson,getting this {} only not the whole json.