APIDemos 8 PersistenceState,持久文本“保存”在哪里?

发布于 2024-09-11 11:48:39 字数 297 浏览 3 评论 0原文

在 PersistentState.java 类中,prefs 变量从先前会话中的第 106 行获取保存/键入的文本到 returnedText 中。 getString 方法从哪里获取保存/输入的文本?

protected void onResume() {
    super.onResume();
...

    SharedPreferences prefs = getPreferences(0); 
    String restoredText = prefs.getString("text", null);

In the class PersistentState.java the prefs variable gets the saved/typed text from prior sessions here, on line 106 into restoredText. Where does the getString method get the saved/typed text?

protected void onResume() {
    super.onResume();
...

    SharedPreferences prefs = getPreferences(0); 
    String restoredText = prefs.getString("text", null);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

看春风乍起 2024-09-18 11:48:39

它将是数据目录中的一个首选项文件,

类似于

/data/com.birthdroid/default.prefs

it will be a prefs file in the data directory

something like

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