有没有简单的方法来为 Android 中的 TextView 创建用户默认值?

发布于 2024-12-29 13:02:43 字数 146 浏览 1 评论 0原文

我正在寻找在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

或十年 2025-01-05 13:02:43

您可以使用 SharedPreferences 存储以前的值,然后从共享中获取以前的值设置为默认值的首选项

You can use SharedPreferences to store previous values and then get previous values from shared preferences to set as default values

自此以后,行同陌路 2025-01-05 13:02:43

只是为了正确地回答你的问题:
您想显示用户上次访问时选择/设置的值吗?

您可以将这些值保存在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文