prevent duplicate file saving

This commit is contained in:
tibbi 2016-06-13 16:34:40 +02:00
parent ee49419162
commit 9a1bc79584
1 changed files with 0 additions and 2 deletions

View File

@ -9,7 +9,6 @@ import android.media.MediaScannerConnection;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v4.content.FileProvider;
@ -148,7 +147,6 @@ public class MainActivity extends AppCompatActivity implements MyCanvas.PathsCha
final File file = new File(directory, fileName);
out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
MediaStore.Images.Media.insertImage(getContentResolver(), file.getAbsolutePath(), file.getName(), file.getName());
MediaScannerConnection.scanFile(getApplicationContext(), new String[]{file.getAbsolutePath()}, null, null);
} catch (Exception e) {
Log.e(TAG, "MainActivity SaveFile " + e.getMessage());