views:

143

answers:

1

I wrote the same program two ways.

One using a Surfaceview, and the other using a custom view. According to the android SDK development guide, using a surface view is better because you can spawn a separate thread to handle graphics. Th SDK development guide claims that using a custom view with invalidate calls is only good for slower animations, less intense graphics.

However, in my simple app, I can clearly see that using a custom view with calls to invalidate seems to render faster.

What do you guys know/think about this?

My touchEvent code is exactly the same, and my drawing code is exactly the same. The only difference is that one is all in the UI thread, and the other is using a tread to handle the drawing.

A: 

SurfaceView enables to work on 2 buffer for drawing, how about your custom view?

Another thing: You mentioned that the doc says invalidate works fast on slower animations/less intense graphics. How intense is your "simple app"? You should try to do a stress test and also take in account, how the single thread handles your touch-input.

I have 3 threads in my game. One for game logic, one for drawing and then the "normal" UI thread...

WarrenFaith
my app takes touch inputs and draws a circle that follows your finger as you slide around on the touch screen. I notice a bit more of a lag with the surfaceview version of the app.I'd say, my app isn't intense in terms of processing of UI input, and graphics.
CrazyJay
Then i define intense otherwise. To determine the real performance, you should seperate touch processing and graphic to different threads for the surfaceview. Then you get real results. Also make more then one circle to draw, because intense is more... On which device did you test?
WarrenFaith