How android.view.View.invalidate(int l, int t, int r, int b) make only the dirty area redrawn?

by Romain Guy » Sat, 07 Mar 2009 12:12:48 GMT

Sponsored Links
 This just sets the clip bounds. You will receive an onDraw(Canvas)
call as usual and everything you draw outside of the clip bounds will
be ignored. You can do ahead-of-time skips if you know you are
performing intensive computations in onDraw() (which you should not be
doing anyway) but it's most often not worth it.

Romain Guy
Android framework engineer

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them


Other Threads

1. App doesn't run after update

I've been developing an app which uses the camera. It worked fine
until I installed the laterst system update. I was running the app on
my G1 when I saw an alert notifying of some system updates. I chose to
install it, and then after that, my app doesn't run anymore. What is

2. surfaceChanged callback takes a long time to arrive (SurfaceFlinger issue?)

I've implemented a SurfaceView that receives callbacks from the

The first time that I rotate the screen the surfaceChanged callback
takes a long time (~5-10 seconds) to arrive.  This only happens the
first time that the screen is rotated. Subsequent rotations are near

Coinciding with the prolonged callback is the following message:

07-20 17:40:09.153: WARN/SurfaceFlinger(568): timeout expired
mFreezeDisplay=0, mFreezeCount=1

I dug out the android code and found that the SurfaceFlinger class has
a member called mFreezeCount that is set through the following code in
the SurfaceFlinger class.

    status_t err = BnSurfaceComposer::onTransact(code, data, reply,
        // HARDWARE_TEST stuff...

... // skip

 case 1007: // set mFreezeCount
                mFreezeCount = data.readInt32();
                return NO_ERROR;

My question is whether anyone can explain what is setting the
mFreezeCount and whether there is anything that can be done in the
SurfaceView to avoid this from happening?

I am doing all rendering in the SurfaceView on the UI thread. The
onDraw is invoked by making calls to both invalidate() and

Many thanks for any help you can provide.


3. how to run the focus item on the view without using onclick

4. Binder documentation - RFC/peer review

5. how to run the focus item on the view without using onclick

6. How to make Visible Invisible Buttons?

7. wifi/dhcpcd Try again (flock) error