prevent duplicate file saving
This commit is contained in:
parent
ee49419162
commit
9a1bc79584
|
@ -9,7 +9,6 @@ import android.media.MediaScannerConnection;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Environment;
|
import android.os.Environment;
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.FileProvider;
|
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);
|
final File file = new File(directory, fileName);
|
||||||
out = new FileOutputStream(file);
|
out = new FileOutputStream(file);
|
||||||
bitmap.compress(Bitmap.CompressFormat.PNG, 100, out);
|
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);
|
MediaScannerConnection.scanFile(getApplicationContext(), new String[]{file.getAbsolutePath()}, null, null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(TAG, "MainActivity SaveFile " + e.getMessage());
|
Log.e(TAG, "MainActivity SaveFile " + e.getMessage());
|
||||||
|
|
Loading…
Reference in New Issue