如何从一个应用程序发送数据到其他应用程序在android系统? [英] How to send data from one application to other application in android?

查看:319
本文介绍了如何从一个应用程序发送数据到其他应用程序在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从我的一个应用程序的活动在同一程序中发送一些字符串数据到我的其它应用活动Android和不活动之间。怎么做?什么意图过滤器我的其他应用程序需要申报?请尝试用例子来阐述.....

I need to send some string data from my one application activity to my other application activity in android and not between the activities within the same application. How to do that? What intent filters my other application need to declare? Please try to elaborate with example.....

推荐答案

据我可以从你的回答你要找的意图理解:

As far as I could understand from your answer you're looking for intents:

在应用程序A的清单 - 阿尔法在声明意图过滤器范畴DEFAULT和行动= com.your_app_package_name.your_app_name.ActivtiyAlpha

On the manifest of App A - Activity Alpha you declare a intent filter with Category DEFAULT and Action = com.your_app_package_name.your_app_name.ActivtiyAlpha

该在App B,活动测试你把code发动和传递数据:

The on App B, Activity Beta you put the code to launch A and pass the data:

Intent i = new Intent("com.your_app_package_name.your_app_name.ActivtiyAlpha");
i.putExtra("KEY_DATA_EXTRA_FROM_ACTV_B", myString);
// add extras to any other data you want to send to b

然后再打开应用程序A - 阿尔法的活动你把code:

Then back on App A - Activity Alpha you put the code:

Bundle b = getIntent().getExtras;
if(b!=null){
    String myString = b.getString("KEY_DATA_EXTRA_FROM_ACTV_B");
    // and any other data that the other app sent
}

这篇关于如何从一个应用程序发送数据到其他应用程序在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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