android与其他应用的交互
来源:互联网 发布:vr照片拍摄软件 编辑:程序博客网 时间:2024/06/02 16:55
使用隐式的Intent Implicit Intents一般用于从一个app到另一个app
而显示的Intent是用于一个app内页面的跳转
需要声明指定的动作
如Uri number = Uri.parse(“tel:5551234”);
Intent callIntent = new Intent(Intent.ACTION_DIAL, number);
指定电话号码的intent
// Map point based on address
Uri location = Uri.parse(“geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+California”);
// Or map point based on latitude/longitude
// Uri location = Uri.parse(“geo:37.422219,-122.08364?z=14”); // z param is zoom level
Intent mapIntent = new Intent(Intent.ACTION_VIEW, location);
查看地图
Uri webpage = Uri.parse(“http://www.android.com“);
Intent webIntent = new Intent(Intent.ACTION_VIEW, webpage);
查看网页
没有Uri数据类型则用setType()方法来指定intent附带的数据类型,用putextra()来装在mime型数据
Intent emailIntent = new Intent(Intent.ACTION_SEND);
// The intent does not have a URI, so declare the “text/plain” MIME type
emailIntent.setType(HTTP.PLAIN_TEXT_TYPE);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] {“jon@example.com”}); // recipients
emailIntent.putExtra(Intent.EXTRA_SUBJECT, “Email subject”);
emailIntent.putExtra(Intent.EXTRA_TEXT, “Email message text”);
emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(“content://path/to/email/attachment”));
// You can also attach multiple items by passing an ArrayList of Uris
验证是否有App去接收这个Intent
PackageManager packageManager = getPackageManager();
List activities = packageManager.queryIntentActivities(mapIntent, 0);
boolean isIntentSafe = activities.size() > 0;
// Start an activity if it's safe if (isIntentSafe) { startActivity(mapIntent); }
- android与其他应用的交互
- Android利用Intent与其他应用交互
- 【Android training】与其他应用交互 Intent
- 与其他应用交互 Intent
- android 与其他程序交互(一)
- Google Android开发者文档系列-与其他应用程序交互之允许其他应用启动你的Activity
- SAP与其他系统交互的方式
- Android官方培训课程学习(五): 与其他应用交互
- 1.7_Android Training 学习笔记_与其他应用的交互
- App与其他应用交互之隐式意图的使用
- Google Android开发者文档系列-与其他应用程序交互之获取Activity返回的结果
- 5.3 与其他Fragment交互
- 与其他APP进行交互
- WMS与其他系统交互处理需要考虑的问题
- app内嵌H5页面与其他app的交互
- app与其它应用的交互
- 【Android Training - 05】与其他Apps进行交互 [ Lesson 3 - 允许其他app启动你的activity ]
- (六)Interacting with Other Apps与其他应用进行交互
- 学习搭建Git服务器和多人协作开发
- ios9中的一些坑
- Android中的DexClassLoader使用
- unity所有特殊文件夹的用途
- Java中Linked中push(),pop()方法
- android与其他应用的交互
- 面向对象
- 第0篇前言——写给产品人的书
- 5.Utm线程模型
- PreferenceActivity点击事件?
- 在mac上用AndroidStudio1.5 创建NDK开发环境
- TransE算法(Translating Embedding)
- POJ 2236 Wireless Network
- Object-C基础(6)——二维数组、结构体与块