Intent中各种常见的Action
来源:互联网 发布:家庭收支知多少教案 编辑:程序博客网 时间:2024/05/19 17:09
1 Intent.Action_CALL
Stirng: android.intent.action.CALL
呼叫指定的电话号码。
Input:电话号码。数据格式为:tel:+phone number
Output:Nothing
Intent intent=new Intent();
intent.setAction(Intent.ACTION_CALL);
intent.setData(Uri.parse(“tel:1320010001”);
startActivity(intent);
2 Intent.Action.DIAL
String: action.intent.action.DIAL
调用拨号面板
Intent intent=new Intent();
intent.setAction(Intent.ACTION_DIAL);
//android.intent.action.DIAL
intent.setData(Uri.parse(“tel:1320010001”);
startActivity(intent);
Input:电话号码。数据格式为:tel:+phone number
Output:Nothing
说明:打开Android的拨号UI。如果没有设置数据,则打开一个空的UI,如果设置数据,action.DIAL则通过调用getData()获取电话号码。
但设置电话号码的数据格式为 tel:+phone number.
3 Intent.Action.ALL_APPS
String: andriod.intent.action.ALL_APPS
列出所有的应用。
Input:Nothing.
Output:Nothing.
4 Intent.ACTION_ANSWER
Stirng:android.intent.action.ANSWER
处理呼入的电话。
Input:Nothing.
Output:Nothing.
- Intent.ACTION_POWER_CONNECTED;
插上外部电源时发出的广播
6 Intent.ACTION_POWER_DISCONNECTED;
已断开外部电源连接时发出的广播
7.Intent.ACTION_BATTERY_LOW;
String: android.intent.action.BATTERY_LOW
表示电池电量低
8.ACTION_CHOOSER
用来显示一个供用户选择的应用列表,例如,你要打开一个视频,但是这个设备上有多个app都可以播放视频,这时候就会出现一个列表供用户选择,一般情况下是弹出式的。示例:
Java代码 收藏代码
Intent intent = new Intent();
intent.setAction(Intent.ACTION_SEND);
intent.setType(“text/plain”);
Intent intent2 = new Intent();
intent2.setAction(Intent.ACTION_CHOOSER);
intent2.putExtra(Intent.EXTRA_TITLE, “please selete a app”);
intent2.putExtra(Intent.EXTRA_INTENT, intent);
startActivity(intent2);
运行效果:
9.打开gallery
public void gallery(View view) {
//第一个意图打开gallery的action
Intent intent = new Intent(Intent.ACTION_PICK);
//选择所有image文件
intent.setType(“image/*”);
//设置你的返回码
startActivityForResult(intent, PHOTO_REQUEST_GALLERY);
}
10.打开Camera
public void camera() {
Intent intent = new Intent(“android.media.action.IMAGE_CAPTURE”);
// 判断存储卡是否可以用,可用进行存储
if (hasSdcard()) {
intent.putExtra(MediaStore.EXTRA_OUTPUT,
Uri.fromFile(new File(IMAGE_FILE_LOCATION_C)));
}
startActivityForResult(intent, PHOTO_REQUEST_CAMERA);
}
11.正常情况下是photoZoom下打开的是图片剪切功能
public void photoZoom(Uri uri) {
// 裁剪图片意图 Intent intent = new Intent("com.android.camera.action.CROP"); intent.setDataAndType(uri, "image/*"); intent.putExtra("crop", "true"); // 裁剪框的比例,1:1 intent.putExtra("aspectX", 1); intent.putExtra("aspectY", 1); // 裁剪后输出图片的尺寸大小 intent.putExtra("outputX", 150); intent.putExtra("outputY", 150); // 图片格式 intent.putExtra("outputFormat", "JPEG"); intent.putExtra("noFaceDetection", true);// 取消人脸识别 intent.putExtra("return-data", true);// true:不返回uri,false:返回uri imageURI = Uri.parse("file://" + "/" + Environment.getExternalStorageDirectory().getPath() + "/" + "small.jpg"); intent.putExtra(MediaStore.EXTRA_OUTPUT, imageURI); intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString()); startActivityForResult(intent, PHOTO_REQUEST_CUT);}
- Intent中各种常见的Action
- Intent中各种常见的Action
- Android中Intent.action的各种常见作用
- Android开发之Intent.Action Android中Intent的各种常见作用
- Android开发之Intent.Action Android中Intent的各种常见作用
- Android开发之Intent.Action 各种Action的常见作用
- [Android基础知识] 之六:Intent.Action的各种常见应用
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用。
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用。
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用
- Android中Intent的各种常见作用
- 本文介绍Android中Intent的各种常见作用
- Java ,== ,equals的区别
- 第七周项目3:友元类
- TCP/IP(2)
- Push 的工作机制
- Scala类与对象
- Intent中各种常见的Action
- Android学习基本索引(四)——记录,没事自己看
- 南阳oj 题目6 喷水装置(一)
- ios推送之远程推送
- 练习15:读取文件
- php 中的伪静态
- spring - property和constructor-arg的使用
- jquery 验证插件简单原理
- 7Cable master