Fast screen update

by qute » Tue, 22 Jun 2010 04:27:07 GMT

Sponsored Links

I'm new to this android development.
I've read a lot on the net how to do it, but I can't get the speed I

In init:
bitmap = Bitmap.createBitmap(WIDTH, HEIGHT, Bitmap.Config.ARGB_8888);

my onDraw method:
protected void onDraw(Canvas canvas) {

for (int j = 0; j < HEIGHT-2; j++) {
int heat = 0;
for (int i = 0; i < WIDTH; i++) {
heat = firebuf[j][i];
bitmap.setPixel(i, j, palbuf[heat]);

canvas.drawBitmap(bitmap, 0, 0, null);

// refresh the canvas

Is this the way to do it?
I come from the PC world, where I would have 2 buffers directly to the
gfx card. Write in one while the other is shown and then switch.
Couldn't find out how to do it on the android.


Fast screen update

by Miguel Morales » Tue, 22 Jun 2010 04:44:28 GMT

 Well, it looks like you're setting every pixel on the bitmap on every frame.
Android is not a PC, it's equivalent to a 10-15 year old pc, you'll
have to optimize your code.

You can try drawing directly to the canvas, instead of drawing to a
bitmap, and then drawing that bitmap onto the canvas.
Watch this: 
and then download things like this: #trunk/SpriteMethodTest
and this to see how it's done in production:  (it's an open source 2d game)


Sponsored Links

Other Threads

1. farid Rahman wants to chat


farid Rahman wants to stay in better touch using some of Google's coolest new

If you already have Gmail or Google Talk, visit:
You'll need to click this link to be able to chat with farid Rahman.

To get Gmail - a free email account from Google with over 2,800 megabytes of
storage - and chat with farid Rahman, visit:

Gmail offers:
- Instant messaging right inside Gmail
- Powerful spam protection
- Built-in search for finding your messages and a helpful way of organizing
  emails into "conversations"
- No pop-up ads or untargeted banners - just text ads and related information
  that are relevant to the content of your messages

All this, and its yours for free. But wait, there's more! By opening a Gmail
account, you also get access to Google Talk, Google's instant messaging

Google Talk offers:
- Web-based chat that you can use anywhere, without a download
- A contact list that's synchronized with your Gmail account
- Free, high quality PC-to-PC voice calls when you download the Google Talk

We're working hard to add new features and make improvements, so we might also
ask for your comments and suggestions periodically. We appreciate your help in
making our products even better!

The Google Team

To learn more about Gmail and Google Talk, visit:

(If clicking the URLs in this message does not work, copy and paste them into
the address bar of your browser).

"Indonesian Android Community [id-android]" 

2. Forward Locking and ZappMarket

I've come to a critical decision in whether to use a web-based-site HTML 5
or an Android mobile-client to allow users to download purchased
applications for ZappMarket. This has implications in regards to piracy so I
wanted to get some feedback from the community.

Solutions like Android Market and SlideME will save the application to a
private space on the device. This is effective for non-rooted devices. A
direct download through the browser will leave the application on the SD

The pros of a mobile client:
1) Can lock downloads of applications to a specific device id (protects
against sharing of accounts)
2) Save application to private space providing better protection than an SD
3) Provide information such as carrier and country of the user downloading
the application

Cons of mobile-client:
1) Requires extra step (download of mobile client) for the user to get to
and purchase an application. This results in less sales
2) Additional maintenance of needing to do an android client release for new
3) Protecting of the application requires double the application size to

Basically, my feeling is that I can help developers drive sales more quickly
with an HTML5 site for downloads. Initially, I felt the piracy protection of
a mobile-client was worth the extra hit to sales but with piracy so rampant,
I don't know if such protections are worth the cost anymore.

Would developers consider using a solution that leaves the application open.
This would be equivalent to turning off forward-lock on the Android market.

Shane Isbell (Founder of ZappMarket)


3. AudioRecord: onPeriodicNotification and onMarkerReached are not called

4. AudioRecord creates a stereo file instead of a mono file.

5. Urgent Help: AudioTrack class ...Streaming Mode

6. Display progress of xml parsing?

7. Listener on Spinner