Android系统拍照之后回显并且获取文件路径

 /*调用拍照返回*/
            case PHOTO_REQUEST_GALLERY:
                if (data != null) {
                    Uri uri = data.getData();
                    String photopath = null;
                    Cursor cursor = LocationApplication.getContext().getContentResolver().query(uri, null, null, null, null);
                    if (cursor != null && cursor.moveToFirst()) {
                        photopath = cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA));
                        Log.e("photopath", "photopath:------------" + photopath);
                    }


                    /*显示缩略图*/
                    custom_menu_videos.setVisibility(View.GONE);
                    custom_menu_yinpin.setVisibility(View.GONE);
                    BitmapFactory.Options options = new BitmapFactory.Options();
                    options.inSampleSize = 2;
                    Bitmap bm = BitmapFactory.decodeFile(photopath, options);
                    filePath = photopath;
                    custom_menu_img.setImageBitmap(bm);
                    rl_photo_scale_all.setVisibility(View.VISIBLE);
                    custom_menu_img.setVisibility(View.VISIBLE);
                }

 

posted @ 2017-07-10 15:32  丁先森  阅读(2296)  评论(0编辑  收藏  举报