- How to keep a Bitmap in memory
- public class MyView extends View {
- private static Bitmap star;
- public MyView(Context context) {
- synchronized(this) {
- if (star == null) {
- star = BitmapFactory.decodeResource(getResources(), R.drawable.star);
- }
- }
- }
- // ...
- }