如何保存意图 [英] How to save Intents

查看:150
本文介绍了如何保存意图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序启动按钮,可以由用户设置为启动一个应用程序或快捷方式。有林的问题是如何保存这些意图,然后重新装入当应用程序被关闭并重新启动。我节省了包名和活动名称两个字符串并重新创建这些简单的应用程序将启动,但不工作为工作的事情,有一个像DirectDials或保存导航位置额外数据的意图。

I have launcher buttons in my app that can be set by the user to either launch an application or a shortcut. The problem Im having is how to save those intents and then reload them when the application is closed and restarted. I was saving two strings for the package name and activity name and recreating the intent which works for simple application launches but doesnt work for things that have extra data like DirectDials or Saved Navigation locations.

推荐答案

您是否尝试过使用意向类的 toUri()的方法?所有的意图的数据应是在URI

Have you tried using the Intent class's toUri() method? All the data for the Intent should be in the URI.

这篇关于如何保存意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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