17

I've added about 35 images to my res/drawable folder and another 30 sound files to res/raw folder. Now my application takes a good 5 seconds longer to start even tough only 1 image and 1 sound resource is used for the startup screen. That makes me ask: When are my image resources loaded into memory?

Are they loaded when the application starts or when I use them for the first time? (Ex: when I call ImageView.setImageResource(myResId);)

If they are all loaded when the app starts, how can I avoid this? If each one is loaded on demand, why is my application taking longer to start?

Info about app for insight: Single activity with a ViewPager. Each view page uses one of the image resources which is a jpeg file with 700x400 px resolution (~50K) and one of the sound files which is an mp3 file <5 sec (~60K).

e-mre
  • 3,305
  • 3
  • 30
  • 46

2 Answers2

1

Are they bitmaps? I found this in the android dev website:

http://developer.android.com/training/displaying-bitmaps/process-bitmap.html

recheej
  • 149
  • 2
  • 14
0

This probably will answer your question https://stackoverflow.com/a/40282371/1603602.

The short answer based on the information in this link is: All resources are loaded in the memory regardless of you used them or not.

user1603602
  • 984
  • 1
  • 7
  • 11