Save the object after closing the app and get it when the app is restarted
I have this object and I want to save it after the application is closed and retrieve it when the application starts again.
final LatLng CENTRAL_VIEW = new LatLng(24.205835,-20.753174);
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(CENTRAL_VIEW) // Sets the center of the map to Central View
.zoom(6) // Sets the zoom
.build(); // Creates a CameraPosition from the builder
googlemap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
What's a simple example for this? Thank!
+3
source to share
3 answers
As Paresh said, we cannot store the object in SharedPreference
, but we can change our preference using some external library to keep the object the same as me. CustomSharedPreference
Try to use it.
0
user744881
source
to share