Alternatives to using 'createScaledBitmap' when adding 3D

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

Alternatives to using 'createScaledBitmap' when adding 3D

Postby TAKEphONE » Fri Dec 04, 2009 7:16 am


I am building an app that moves up to 12 images on screen, and responds to touch events. Using the sample code I found on the web, it seems to work great.

I have a problem, though - I am writing something similar, but it requires adding 3D - meaning emulating the objects moving in the Z axis, too (in/out of screen).

To do this, I need to resize the images as they move.

To test this, I changed the following line in the onDraw (Panel) code:

canvas.drawBitmap(bitmap, coords.getX(), coords.getY(), null);


Bitmap bmpScaled = Bitmap.createScaledBitmap(bitmap, 112, 112, false);
canvas.drawBitmap(bmpScaled, coords.getX(), coords.getY(), null);

Which works, BUT - movement on screen, plus response to touch events becomes real Jiggly.

Checking the log I see that every call to createScaledBitmap causes garbage collection of around 90mS, which causes the total app to respond jiggly.

Tried preparing 20 sized bitmaps beforehand, but since that moves the calls to those createScaledBitmap to the beginning of the app - it takes forever to load...

Can you think of any workaround or other way to achieve the scaling effect ?


Junior Developer
Junior Developer
Posts: 20
Joined: Mon Nov 03, 2008 11:35 am


Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 15 guests