views:

50

answers:

1

I am at a stage where I can understand and write a decent Android application. At this stage, I am still not comfortable with SurfaceHolder, Canvas, View invalidate() etc. I don't have a CS background so I must've missed these from a CS Graphics course or something.

Starting directly with Android seemed like a bad idea because there are not many examples out there. And sometimes I am getting things done, but I don't understand what the heck is going on. For instance, there are a few dangling observations. Calling invalidate() from within a view calls its onDraw method but from outside it doesn't do anything and I don't know why this is happening. I know SurfaceHolder can be a powerful thing but I don't know how to use it.

For an absolute beginner to be able to handle this stuff, what are the resources one should follow? Is it animation basics or screen rendering or something else altogether? I mean, it cannot be the case that Android guys invented these concepts right? They must be similar to something out there which has some tutorials already. My end goal is to put myself in a position where I can write some simple custom views that can animate themselves and use some basic physics to react to touch events.

A: 

Since you can understand and write applications I'm assuming you're comfortable with programming, so here are some resources I think you'll find helpful to use when developing your, well, developing skills:

For reacting to touch events, you should explore the MS Touch API, if you explore and spend some time practicing you can get a good hold on how touch events work (messages, manipulation, inertia support, etc. Note this is in C# but it's just a matter of understanding the concepts.):
http://msdn.microsoft.com/en-us/library/dd317323(v=VS.85).aspx

Here are some examples of animations using C# (I figured it would be best to use C# here as well so you can maybe make them work together to make something that combines Touch and 2D animation): http://www.java2s.com/Code/CSharp/2D-Graphics/Animation.htm

This should give you decent/different experience with animations and touch events if you practice them. Then maybe you will become a bit more comfortable with the android API (the Canvas's functionality and methods like all the clip____() and draw____() methods shouldn't seem as troublesome for you then).

Good luck and happy programming!

rownage