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
Vis
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
save the object in general settings and get it after restarting the application .... Simple ..
-1
Anand
source
to share
see this, this might help you:
http://androidcodemonkey.blogspot.in/2011/07/store-and-get-object-in-android-shared.html
http://www.thetekblog.com/2012/09/android-store-objects-in-sharedperferences/
http://www.mediafire.com/?a9x1ebyw1bf8t62
-1
Anand
source
to share