We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
use
1 parent 363ec37 commit dee5774Copy full SHA for dee5774
android/src/main/java/com/sourcetoad/reactnativesketchcanvas/SketchCanvas.kt
@@ -362,11 +362,13 @@ class SketchCanvas(context: ThemedReactContext) : View(context) {
362
if (format == "png") ".png" else ".jpg"
363
)
364
try {
365
- bitmap.compress(
366
- if (format == "png") Bitmap.CompressFormat.PNG else Bitmap.CompressFormat.JPEG,
367
- if (format == "png") 100 else 90,
368
- FileOutputStream(file)
369
- )
+ FileOutputStream(file).use { fos ->
+ bitmap.compress(
+ if (format == "png") Bitmap.CompressFormat.PNG else Bitmap.CompressFormat.JPEG,
+ if (format == "png") 100 else 90,
+ fos
370
+ )
371
+ }
372
onSaved(true, file.path)
373
} catch (e: Exception) {
374
e.printStackTrace()
0 commit comments