I am moving photo from on directory to another using following code
File oldfile= new File(originalImagePath);
File newfile=new File(newImagePa
if (Build.VERSION.SDK_INT < 19)
mContext.sendBroadcast(new Intent(
Intent.ACTION_MEDIA_MOUNTED,
Uri.parse("file://"
+ Environment.getExternalStorageDirectory())));
else {
MediaScannerConnection
.scanFile(
mContext,
new String[]{imageFile.toString()},
null,
new MediaScannerConnection.OnScanCompletedListener() {
public void onScanCompleted(
String path, Uri uri) {
Log.i("ExternalStorage", "Scanned "
+ path + ":");
Log.i("ExternalStorage", "-> uri="
+ uri);
}
});
}
to remove from gallery
try {
getContentResolver().delete();
} catch (Exception e) {
e.printStackTrace();
}