关闭应用后保存对象,并在应用再次运行时检索它

时间:2013-01-31 11:41:31

标签: android

我有这个对象,我想在关闭应用程序后保存它,并在应用程序再次运行时检索它。

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));

有什么简单的例子吗?谢谢!

3 个答案:

答案 0 :(得分:0)

正如Paresh所说,我们无法在SharedPreference中存储对象,但我们可以使用一些外部库来修改我们的首选项,以便像我一样存储对象。 CustomSharedPreference

尝试使用它。

答案 1 :(得分:-1)

将您的对象保存到共享首选项中,并在重新启动应用程序后获取.... 简单..

答案 2 :(得分:-1)

相关问题