1

In my Activity, I use imageView.setImageResource(R.drawable.image_name); about 8 times for different views.

I kept opening and closing the activity repeatedly and I notice the app is getting laggy. I am wondering if this is related to memory leak? Is it because of that piece of code?

JayVDiyk
  • 4,277
  • 22
  • 70
  • 135
  • now should be the time to start using `MAT` and checking what is still in memory – thepoosh Jan 27 '16 at 06:45
  • Totally a opinion based question. What are your findings ? did you use any Memory Analysis tool ? like MAT or so ? how big is your image ? what resolution is your image? how much device memory has ? what is the heap size ? – Murtaza Khursheed Hussain Jan 27 '16 at 06:48

1 Answers1

2

You should recycle() all your bitmaps when done using them. If you want to destroy them when activity is finish()ed, you can override onDestroy to destroy all bitmaps