Android调用手机相册返回图片路径

private static final int REQUEST_PHOTO_CODE = 200;
跳转到相册

Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
intent.setType("image/*");
startActivityForResult(intent, REQUEST_PHOTO_CODE);

 

返回路径

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK && requestCode == REQUEST_PHOTO_CODE) {//获取系统照片上传
        String photoPath = getPhotoFromPhotoAlbum.getRealPathFromUri(this, data.getData());
        Log.i("TAG",photoPath+"====");
        Glide.with(this).load(photoPath).into(imageView)
        ;
     
    }
 
}

 

你可能感兴趣的:(Android调用手机相册返回图片路径)