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);
                }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM