Intent 常用调用系统action
2016-08-05 21:48
295 查看
Intent : 打开网址
Intent : 拨号
Intent:打电话
Intent : 启动相册
Intent: 打开相机
Intent: 打开相册图片
Intent : 打开录音
上面的系统回调返回
Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); Uri uri = Uri.parse("http://www.baidu.com"); intent.setData(uri); tartActivity(intent);
Intent : 拨号
Intent myIntent = new Intent(); Uri uri = Uri.parse("tel:123456"); myIntent.setAction(Intent.ACTION_DIAL); myIntent.setData(uri); startActivity(myIntent);
Intent:打电话
Intent intent = new Intent(); intent.setAction(Intent.ACTION_CALL); Uri uri = Uri.parse("tel:123445"); intent.setData(uri); startActivity(intent);
Intent : 启动相册
Intent intent = new Intent(); intent.setAction(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent,100);
Intent: 打开相机
Intent intent = new Intent(); intent.setAction(MediaStore.ACTION_VIDEO_CAPTURE); startActivityForResult(intent,200);
Intent: 打开相册图片
Intent intent = new Intent(); intent.setAction(Intent.ACTION_PICK); intent.setDataAndType(MediaStore.Images.Media.INTERNAL_CONTENT_URI,"image/*"); startActivityForResult(intent,300);
Intent : 打开录音
Intent intent = new Intent(); intent.setAction(MediaStore.Audio.Media.RECORD_SOUND_ACTION); startActivity(intent);
上面的系统回调返回
protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == 100 && resultCode == Activity.RESULT_OK) { Bundle bundle = data.getExtras(); Bitmap bitmap = (Bitmap) bundle.get("data"); ImageView tupian = (ImageView) findViewById(R.id.tupian); tupian.setImageBitmap(Bitmap.createBitmap(bitmap)); } if (requestCode == 200 && resultCode == Activity.RESULT_OK) { String s = data.getData().toString(); Toast.makeText(MainActivity.this, "视频保存在" + s, Toast.LENGTH_SHORT).show(); } if (requestCode == 300 && resultCode == Activity.RESULT_OK) { ImageView iv = (ImageView) findViewById(R.id.opentupain); Uri selectedImage = data.getData(); String[] filePathColumn = { MediaStore.Images.Media.DATA }; Cursor cursor = getContentResolver().query(selectedImage, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); String picturePath = cursor.getString(columnIndex); cursor.close(); iv.setImageBitmap(BitmapFactory.decodeFile(picturePath)); } }
相关文章推荐
- android 通过Intent action 跳转到系统页面,调用系统功能以及action动...
- android 通过Intent action 跳转到系统页面,调用系统功能以及action动...
- Android系统Intent,系统Action调用大全
- Intent.ACTION_PICK和Intent.ACTION_GET_CONTENT 调用系统联系人;图片;音乐;视频;
- Android调用系统组件常用uri & intent设置
- MiUi4.5.30 调用系统相机并且剪裁出现:No Activity found to handle Intent { act=com.android.camera.action.CROP
- 使用Intent.ACTION_EDIT 调用系统编辑联系人
- 分享:用Intent调用常用的系统组件
- Android开发——Intent调用系统组件21个常用小示例
- android 通过Intent action 跳转到系统页面,调用系统功能以及action动作
- android 通过Intent action 调用系统功能
- 【Android】调用系统应用常用uri & intent设置
- Android 通过Intent调用系统功能和Action动作和服务广播【大全】
- 【Android】调用系统应用常用uri & intent设置
- android 通过Intent action 跳转到系统页面,调用系统功能以及action动作
- Intent的属性及Intent-filter配置——指定Action、Category调用系统Activity
- android 通过Intent action 跳转到系统页面,调用系统功能以及action动
- Intent中常用的系统Action
- 【Android】intent action 跳转到系统使用,调用系统功能
- Android常用系统Intent.Action小例子