I can get external sd card file data from the
MediaStore.Files.FileColumns._ID, and MediaStore.Files.FileColumns.DATA.
And I can use below code get the image thumbnails photo.
MediaStore.Video.Thumbnails.getThumbnail(context
.getApplicationContext().getContentResolver(), item.getMediaId(),
MediaStore.Images.Thumbnails.MINI_KIND, null);
Now I can get the media data full path.
Using below code to delete file.
File file = new File(String.valueOf(path));
if( file.exists() ) {
boolean delted = file.delete();
Log.i(TAG, "delted:/ :" + delted + "path:" + String.valueOf(path));
// log show: false/ /storage/sdcard0/DCIM/100ANDRO/DSC_0012.jpg
}
I found the file was not removed the path file.
I want to remove the file(real path photo and thumbnails phptp) from the path or ID.
How can I remove the file from get ID or path, and where my code problems?
thank you very much.
P.s I had add permission below:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Aucun commentaire:
Enregistrer un commentaire