get "black screen" when call unlockCanvasAndPost

by 鐒?鍒 » Thu, 02 Sep 2010 01:58:51 GMT

Sponsored Links
The source code as an example :

        Canvas c=mHolder.lockCanvas(null);
        Paint paint=new Paint();
        c.drawRect(new RectF(40,60,80,80), paint);

My aim is to draw several graphics using lockCanvas and
unlockCanvasAndPost at different places controled by keydown event,but
each time when I press the key,the screen becomes black and only
drawing current graphics,when pressing the key again,the background
So how to overcome this problem?


Other Threads

1. How does Market calculate popularity?

I am a bit confused about how the Market calculate the "popularity" for the
apps. For example, I dont' understand why one app, with 5000-10000
downloads, rated 3.51 with a total 68 reviews, is considered more popular
than another app, with 10000~50000 downloads, rated 4.47 with a total of 398


2. More help with hardware acceleration

The silence was a bit deafening on my last question, but I'll try it
again with some more specific questions.

Obviously, I'm having a bit of trouble hooking up my non-framebuffer
accelerated graphics.  While working on this, I've noticed a very odd
thing.  The surface flinger's createSurface() call is being called
with width and height of 0.  Which causes the LayerBitmap to allocate
0 bytes of data for that layer's texture.  Eventually, I see that
LayerBitmap::setBits() is called again with an appropriately sized
texture and the buffer is re-allocated in a different place.

So, my questions are:
1)  From where do the width and height that are passed to the
createSurface call come?
2)  How does the texture get "rendered" into the layer's mBuffers[]
data?  Why are there two mBuffers?

I think that my rendering is working correctly, the problem is that
there doesn't seem to be any texture data in the mBuffers[] data
buffer.  I also think that this may be due to the initial buffer
allocation being made based on a 0x0 surface size.

Can anyone offer some insight into how the sizes passed to
createSurface are determined, and how the layer buffer gets used in
the rendering path?

If I am using the "generic" layer texture rendering path, am I not
getting full acceleration?  I assume that this is false, and that the
texture data is a static resource that is simply copied into the
buffer location for blitting by the hardware later.

Steve Aarnio

3. How to use the

4. Ubuntu Jaunty and adb not playing well together

5. broadcasts as communication path between custom views and activity

6. Doubt in video sink and audio sink

7. Change to signature for Camera.setPreviewDisplay() in 1.5