SurfaceViews handling, Thread, and general game design

by Dianne Hackborn » Wed, 15 Jul 2009 00:06:43 GMT

Sponsored Links
  very strongly recommend that you don't use multiple surface views.  A
surface view is a very heavy-weight object, and intended for the primary
area of the window -- for example, the video part of a video player, the
playfield of a game, etc. It is basically an overlay, and actually its own
separate full window that is simply being Z-ordered with your main window to
make it look like they are related.

I don't know what your "complicated" animation sequence is, but just having
some animation is not enough reason to use a surface view. Worst case, you
can just create an off-screen bitmap that you draw the animation in and
update the screen by drawing that bitmap to the screen with the normal
invalidate() mechanism. If you need the performance of a surface view, then
you should design your game so that your entire playfield is on surface
view, and you take care of drawing each of your boxes inside of that and
manage them however you want (not as their own views).

On Tue, Jul 14, 2009 at 4:27 AM, ayanir <> wrote:

Dianne Hackborn
Android framework engineer

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


Other Threads

1. How to connect content provider in ProviderTestCase2 class?

I try to build a class which extends ProviderTestCase2 to test my
content provider.

But I don't know how to connect my content provider and also don't
find any document about this case.
In CalendarProviderTest, they create a Mock Provider and use
mResolver = getMockContentResolver();
to new a provider.

But I still don't know why they use this method.

My sample code as follows:

public class ABCProviderTest extends ProviderTestCase2<TaskProvider> {

    private SQLiteDatabase mDb;
    private Context mContext;
    private MockContentResolver mResolver;

    public ABCProviderTest () {
        super(ABCProvider.class, "");

    protected void setUp() throws Exception {
        mContext = getMockContext();
        mResolver = getMockContentResolver();
        mDb = getProvider().getDatabase();

    protected void tearDown() throws Exception {

    public void testProviderColumns() {
        Cursor cursor;
        Uri url = ABCProvider.CONTENT_URI;
        cursor = mResolver.query(url, null, null, null, null);
        assertEquals(10, cursor.getColumnCount());

Is there any suggestion about how to connect content provider and test
it by ProviderTestCase2?

2. How to use remapCoordinateSystem of SensorManager

Dear all,

          I want to transform the coordinate in Camera style. But I
really can't understand how to use  remapCoordinateSystem. Is there
any example to help me understand how to use?

Best regards,
Augustin Lu.

3. pmem usage in opencore of Android1.5

4. Emulator not showing on screen from cmd.

5. Changing one TextView with onSensorChanged without Redrawing the Entire Layout

6. wifi/wpa_supplicant

7. Passing pmem FDs from OMX to MIO