Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- String key = "Key";
- List<CartProductListPojo> cartProductListPojos = new ArrayList();
- cartProductListPojos.add(new CartProductListPojo( getItemId.getProductImage(),
- getItemId.getProductName(),
- getItemId.getProductBrandName(), getItemId.getProductCategory(), 1,
- getItemId.getProductPrice()));
- SharedPreferences shref;
- SharedPreferences.Editor editor;
- shref = context.getSharedPreferences("Name", Context.MODE_PRIVATE);
- Gson gson = new Gson();
- String json = gson.toJson(cartProductListPojos);
- editor = shref.edit();
- /*editor.remove(key).commit();*/
- editor.putString(key, json);
- editor.commit();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement