Android: remove an image from sd card
问题 I need to remove an image from sd card chosen by user. In my Activity, after an user select an image from gallery, i execute this code: public void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == RESULT_OK) { if (requestCode == SELECT_PICTURE) { Utils.imgUri = data.getData(); Utils.imgPath = getPath(Utils.imgUri); File file = new File(Utils.imgPath); boolean deleted = file.delete(); } } } where getPath method is: public String getPath(Uri uri) { String[]