Android 图片选择器
来源:互联网 发布:颈椎牵引器 淘宝 编辑:程序博客网 时间:2024/06/06 04:00
1 事件调用,RESULT_LOAD_IMAGE = 1
Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(i, RESULT_LOAD_IMAGE);2 选择文件后,返回结果
protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (requestCode == RESULT_LOAD_IMAGE && resultCode == RESULT_OK && null != data) { 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]); picturePath = cursor.getString(columnIndex); Bitmap bitmap = BitmapFactory.decodeFile(picturePath); ImageView image = (ImageView) screenShow.findViewById(R.id.hw_update_screen_image_view1); image.setImageBitmap(bitmap); screenImage = bitmap; cursor.close(); } }
0 0
- Android图片选择器
- Android 图片选择器
- android图片选择器
- Android图片选择器
- Android 图片选择器
- Android-仿微信图片选择器
- Android 仿微信图片选择器
- android 图片选择器 photopicker
- Android 高仿微信图片选择器
- Android 图片选择器
- Android 图片选择器
- Android图片选择器
- android 图片选择器
- Android之图片选择器
- Android图片文件选择器
- Android 图片选择器
- Android仿微信图片选择器
- Android自定义图片选择器
- 自定义View系列教程02--onMeasure源码详尽分析
- 6------cocos2dx-------3.3<LUA>官网英文版
- 【Algothm】动态规划实例6
- 剑指offer|从上往下打印二叉树
- Android_关于Activity的生命周期及一些理解
- Android 图片选择器
- Ryan的OC学习总结-----9 Foundation框架
- emacs中出现调用wakatime的错误
- Python 键盘鼠标监听
- 支付宝和微信移动支付的个人总结
- mysql-\g和\G的作用
- 第15周项目二—洗牌(3)
- SICP 习题2.36 accumulate-n的实现
- 获取sha1