有没有简单的方法来为 Android 中的 TextView 创建用户默认值?
我正在寻找在 Android 中为 TextView 创建用户默认值的简单方法:我需要标准解决方案,让用户看到他在 TextView 中输入的先前值。当然,有办法将 TextView 的值存储在某处,然后在启动活动时再次读取它,但是,可能有任何简单的工具可以得到我想要的东西吗?
I'm looking for simple way to create user defaults values for TextView in Android: I need the standart solution that user is seeing the previous value, that was entered by him to the TextView. Sure, there is way to store value of TextView at somewhere and then read it again while starting activity, but, may be, there is any simple tool to get what I wish ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用 SharedPreferences 存储以前的值,然后从共享中获取以前的值设置为默认值的首选项
You can use SharedPreferences to store previous values and then get previous values from shared preferences to set as default values
只是为了正确地回答你的问题:
您想显示用户上次访问时选择/设置的值吗?
您可以将这些值保存在 SharedPreferences 中 - 这就是它们的用途。
您可以尝试一下
google Prediction api
。Just to get your question correctly:
You want to present the values the user selected/set in his last visit?
You can save those values in the SharedPreferences - That's what they're made for.
You can give the
google prediction api
a try.