- // Convert the home folder bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
- homeFolderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, homeFolderIconByteArrayOutputStream)
+ // Compress the bitmap using a coroutine with Dispatchers.Default.
+ CoroutineScope(Dispatchers.Main).launch {
+ withContext(Dispatchers.Default) {
+ // Convert the home folder bitmap to a byte array. `0` is for lossless compression (the only option for a PNG).
+ homeFolderIconBitmap.compress(Bitmap.CompressFormat.PNG, 0, homeFolderIconByteArrayOutputStream)
+ }
+ }