I have a custom control that displays a series of image tiles. The
images come in in a different thread. When they arrive the control
invalidates in order to display the updated total image. This works
very well the first time. However, if I hit the back button then load
the activity again, nothing shows up. I put a break point on the
postInvalidate() and it gets called every time. However, the onDraw
method does't. Here is my code:
public class TiledImageView extends View {
private CopyOnWriteArrayList<TiledBitmap> bitmaps = new
CopyOnWriteArrayList<TiledBitmap>();
public TiledImageView(Context context) {
super(context);
}
public void addBitmap(Bitmap b, int x, int y){
TiledBitmap tb = new TiledBitmap();
tb.b = b;
tb.x = x;
tb.y = y;
bitmaps.add(tb);
this.postInvalidate();
}
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
canvas.drawColor(Color.WHITE);
for(TiledBitmap tb : bitmaps){
canvas.drawBitmap(tb.b, tb.x * 64, tb.y * 64, null);
}
}
private class TiledBitmap{
public Bitmap b;
public int x;
public int y;
}
}
On another note, it images are never displayed in landscape mode. I
also have to tackle how to make this scroll for big images but I need
to get this working first.
Thanks for you help.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en