After getting to know the onTouchEvent() a little better I decided to figure out the coordinate system of the Android graphics system and put in some movement logic. I thought I needed to figure out how to use the velocity tracker in order to do this, which is a very cool class and its a little different approach than other graphics systems I have coded to in the past. Once I got the concept, I was able to capture where the touch was started and where it ended along with how fast it was. The key is to coordinate the MotionEvent.ACTION_DOWN and the MotionEvent.ACTION_MOVE event types. Once I got the concept of how to use these events the code became much easier and I actually didn’t even end up using the velocity tracker!
Here is a basic system I created to figure out where the touch happened and as the square is dragged across the board I calculate what square the touch is over by highlighting the square in blue.
“Duck typing is based upon the saying that if it walks like a duck and quacks like a dck, then its a duck.”
The book I have been blogging a bit about lately has a site with a section under posts where the actual interviews with the industries brightest are posted. Each interview is a part of a chapter in the book, I believe Sam will be posting them all eventually. I think this is an interesting concept and I found the actual recording more interesting than the written interviews in the book because I got to hear their voices. I do think the textual versions of the interviews are very good in that you can reference them but I really like hearing the voices. Maybe in the future there will be some sound chip on the page where you can listen to it. It would be cool if the eBook version had the audio attached to the interview pages – hint Sam…