sromku / android-storage

Create, read, delete, append, encrypt files and more, on internal or external disk spaces with a really simple API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Crash when bitmap pass for create file

tabassumLatif opened this issue · comments

java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:309)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:354)
at java.util.concurrent.FutureTask.setException(FutureTask.java:223)
at java.util.concurrent.FutureTask.run(FutureTask.java:242)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Caused by: java.lang.IllegalStateException: Can't compress a recycled bitmap
at android.graphics.Bitmap.checkRecycled(Bitmap.java:400)
at android.graphics.Bitmap.compress(Bitmap.java:1307)
at com.sromku.simple.storage.AbstractDiskStorage.createFile(AbstractDiskStorage.java:137)
at com.sromku.simple.storage.ExternalStorage.createFile(ExternalStorage.java:17)

You have to send a non-recycled bitmap (with methods Bitmap.createBitmap(yourBitmap) or yourBitmap.copy(yourBitmap.getConfig(), false); this library can't save your bitmap if it's already recycled.