节省了标签数据 [英] saving data on tabs

查看:80
本文介绍了节省了标签数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有3个标签,每一个单独的活动。我想保存数据时,用户点击保存在任一选项卡。有几个可供选择;共享preference,全局变量或保存对象范围内。

I have 3 tabs, each a separate activity. I want to save data when user clicks save on either of the tabs. There are couple of options available; shared preference, global variables or saving the objects in context.

编辑:我必须保存图像和放大器;文本框

I have to save an image & textfield

Android的共享preferences

在ApplicationContext中存储对象

任何建议,哪种方法来接? 谢谢

Any suggestions on which method to pick ? thanks

推荐答案

这完全取决于时间的长短要保存它们。

That is entirely dependent upon the length of time you wish to store them for.

存储在应用程序上下文将不会保留应用程序结束后的数据。它只是存储在内存中。

Storing in the Application Context will not persist data after the application has ended. It just stores in memory.

共享preferences是一个可能性,你的字符串数据,但图像数据需要一些操作和可能有其他限制的数据例如大小(TBC)。

Shared preferences is a possibility for your string data but image data would require some manipulation and may have other restrictions for example size of data (TBC).

请咨询有关数据存储相关 SDK文档

Please consult the relevant SDK documentation on Data Storage

最方便的方法是将保存在共享preferences文本和图像到磁盘。请参考GETDIR()函数,如果你要存储在应用程序目录

The most convenient way would be to save the text in shared preferences and the image to disk. Refer to the getDir() function if you want to store in the application directory

这篇关于节省了标签数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆