Crapsticks! - Android != Java frustrations
Post date: Mar 13, 2012 7:9:51 AM
I hit the exact problem described here.
Problem is Android looks a WHOLE LOT like java but under the hood it isn't really. It's Android. Because under the hood it executes in it's own little way using it's own special VM, Davlik not JVM. So certain libraries are missing. Most notably for me Swing is incompatable with Android. Drat!
I was trying to add java.swing.Timer to my project. It's perfect for holding the door open for a given period. Swing's timer has a restart() function. So I can call the timer for say 20 seconds or so, however long I think it will take timmothy to go from the camera to the door. However because of the speed of the phone I'm going to detect his mischievous little head probably a hundred or so times before he leaves the frame. Being able to to just call restart on my timer gets rid of most of my problems of dealing with the multiple calls do openDoor() or whatever I call my door open method. I just open it and use a swing timer to reset some status to done and then stop holding the door open.
I will have to use something like java.util.Timer or something related. Oh well.
Which if you haven't guessed means I'm working on the door openning code for TVKP.