0

Hi I want to pass bitmap from activity 1 to activity 2. It is a large bitmap and I can not use a bundle. Now I save bitmap and pass path and read a path and load bitmap I do this :

val path = saveImage(bitmap)
intent.putExtra("bitmap_path", path)
startActivity(intent)

and in activity2

val f = File(intent.getStringExtra("bitmap_path"))
val bitmap= BitmapFactory.decodeFile(f.absolutePath)

How I can do this better I thing about static object bitmap but I know it is a good practice

edit I do this:

class Helper {
    var bitmap: Bitmap? = null

    companion object {
        val instance = Helper()
    }
}
Bruno
  • 3,872
  • 4
  • 20
  • 37
kiki Kala2
  • 399
  • 5
  • 19

0 Answers0