The idea to optimize your code is to perform only the operations necessary for drawing. So you, should remove from your onDraw method :
- any instanciation : they take a long time, onDraw is called often and you don't want to create so many new objects. Store screenPts during onLayout and reuse the same points, always.
- BitmapFactory.decodeResource : this takes quite a long time. Decode your bitmap first, store them and only draw them during onDraw.
- recycle the bitmaps when you don't need them any more, not each time you drew them.
For instance :
- decode your bitmaps during onResume
- recycle them during onPause
- decoding should occur inside an async task. When the async task is over, raise a flag to indicate to onDraw that images are ready and can be drawn.
- it's very important to decode images in background as it takes a long time. Do not do this in main UI Thread. Otherwise your app will look unresponsive
- calculate your screenPts inside onLayout and reuse the same points all the time.
- don't call getIntent during onDraw either.
Briefly, minimize the operations during onDraw and you will achieve very fast drawing, around 60 FPS.
You should also consider removing that (ugly) switch and use an hashmap to associate the values of count and the bitmap to draw. An array would even be faster and maybe more appropriate here.