How to Declare and Initialize a Timer
** Recommended to use a Handler instead **http://www.mopri.de/2010/timertask-bad-do-it-the-android-way-use-a-handler/
Timer was added in API Level 1
1. If you don't already have an Android app, create one.
2. In the MainActivity.java file, add the below code to the imports section.
import java.util.Timer;
3. In the MainActivity.java file, add the below code to the onCreate method. This will create a Timer object named myTimer and initialized it to null.
Timer myTimer = null;
4. Compile and run!
Next Recommended Article: Create a new Timer
Related Articles:
Resources:
http://developer.android.com/reference/java/util/Timer.html
http://docs.oracle.com/javase/tutorial/java/nutsandbolts/variables.html