As you can see on the screenshot, I'm showing thumbnails in the ListView on the left side. Those thumbs are generated asynchronously. Anyway, the result for each row/item is a new Bitmap.

climbing wall management

But I wonder if that's the best practise. This is because very often the background image (the climbing wall) is the same. Therefore I could generate a LayeredDrawable consisting of the background bitmap - which is the same for each row - and an own implementation of a Drawable which then draws the climbing route in its draw(Canvas) method.

Option 1: generate a new bitmap for each row/item.

Option 2: use a LayeredDrawable with the background bitmap and a dynamic Drawable.

Which option is best in terms of memory and CPU usage?

有帮助吗?

解决方案

For my purposes I'm using a custom drawable and a BitmapDrawable within a LayerDrawable. The bitmap is the background and the custom drawable draws the line and holds. If the underlying data of the drawn line changes, I'm setting a dirty-flag so that the drawable is re-drawn on next cycle.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top