通过在Android应用程序之间的数据最简单的方法 [英] The easiest way to pass data between application in Android

查看:152
本文介绍了通过在Android应用程序之间的数据最简单的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是较少或甚至不许可通过两款Android应用之间的数据(字符串值)最简单的方法?此外,在我的情况下,第一个应用程序将数据发送到非存在的应用程序,它被安装,它现在不能听意图。

What's the easiest way to pass data(string value) between two android applications with less or even without permissions? Also in my case first application sends data to un-existed application which is installing and it can't listen for intent right now.

感谢。

推荐答案

您的问题是棘手的,当你不能确保这两个应用程序正在运行。在这样的情况下,必须依靠某种形式的持久性存储上。

Your question is tricky when you can't ensure that both applications are running. In cases like that, you must rely on some form of persistent storage.

如果您关注的是唯一的数据量小,Android提供了共享preferences 以应用程序之间共享preferences。最值得注意的是,你可以添加一个<一个href=\"http://developer.android.com/reference/android/content/Shared$p$pferences.OnShared$p$pferenceChangeListener.html\"相对=nofollow> OnShared preferenceChangeListener 每个应用程序,使他们能够得到通知时,其他变化的值。

If you're concerned with only a small amount of data, Android provides a SharedPreferences class to share preferences between applications. Most notably, you can add a OnSharedPreferenceChangeListener to each application so they can be notified when the other changes the value.

您可以找到在各种不同形式的持久性存储的详细信息Android的网站(http://developer.android.com/guide/topics/data/data-storage.html)

这篇关于通过在Android应用程序之间的数据最简单的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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