任何解决方法,以保存设置的意图是什么?

编程入门 行业动态 更新时间:2024-10-23 11:19:51
本文介绍了任何解决方法,以保存设置的意图是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

希望您能理解我的问题与我的英语基础...

Hope you will understand my question with my basic english...

在我的应用程序,我允许用户有一个按钮,启动了他选择的应用程序。我没有得到任何问题,使所有已安装应用程序的列表,让意图并启动已选定的应用程序。

In my application, I allow the user to have a button that launch the application of his choice. I get no problem to make a list of all installed apps, get the Intent and launch the choosen app.

不过,我想保存相应的意图,在下次用户使用我的应用程序的设置,但设置只允许我保存基本数据类型(整数,布尔,字符串等)

But I would like to save the corresponding intent in the settings for the next time the user use my application, but settings only allow me to save basic data type ( Integer, boolean, Strings, etc. )

所以,我的问题是如何保存的意图在一个聪明的办法。

So, my question is how to save an intent in a smart way.

我希望你能帮助我找到一个解决方案。

I hope you can help me to find a solution.

推荐答案

您应该使用 myIntent.toURI()存储意图,并使用 Intent.getIntent(字符串URI)恢复意图。

You should use myIntent.toURI() to store the Intent, and use Intent.getIntent(String uri) to restore the Intent.

public void saveIntent(Intent intent) { mSharedPrefs.edit().putString(SOME_KEY, intent.toURI())mit(); } public Intent restoreIntent() { String uri = mSharedPrefs.getString(SOME_KEY, *mSomeDefaultUri*); return Intent.getIntent(uri); }

更多推荐

任何解决方法,以保存设置的意图是什么?

本文发布于:2023-05-28 12:29:29,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/320922.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:词库加载错误:Could not find file 'D:\淘小白 高铁采集器win10\Configuration\Dict_Sto

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!