Question

can anybody tell me how to refresh or reset a bitmap or canvas to draw another image on it?

actually i have a map binary file which contains bitmap tiles in bytes now problem is i have a buffer image with buffer image i get screen image to display. so when i move my screen image i need to refresh my buffer image and draw new tiles to display on screen.

here is code to display image.

bitmap = Bitmap.createBitmap(screenWidth * (int)mapState.getiBufferMult(), screenHeight * (int)mapState.getiBufferMult(), Config.RGB_565);
        canvas = new Canvas(bitmap);
        image = new ImageView(this);

this is not full source but i hope you guys can have idea.

thanks a lot

Was it helpful?

Solution

If you generate the bitmap that you want, you can say image.setImageBitmap(yourBitmap);

The Bitmap class also offers methods to modify an existing bitmap or replace just part of it.

If you are using the same bitmap and modifying it, call invalidate () on the ImageView when you have the bitmap ready.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top