Friday, 15 July 2011

java - Android OnDraw() and update with Timer -



java - Android OnDraw() and update with Timer -

i'm trying create game in android 1 time user presses start, there objects flying across screen. think need link ondraw() function timer objects' positions can updated.

currently, next code sample found online prints out text continuously. however, can't import java.awt.event.actionevent , actionlistener. eclipse giving me "the import java.awt.event cannot resolved". there android equivalent actionevent? or done other way? give thanks you.

import java.awt.event.actionevent; import java.awt.event.actionlistener; import javax.swing.timer; public class timersample { public static void main(string args[]) { actionlistener actionlistener = new actionlistener() { public void actionperformed(actionevent actionevent) { system.out.println("hello world timer"); } }; timer timer = new timer(500, actionlistener); timer.start(); } }

use timer android provides , scratch tutorial, check out this.

java android

No comments:

Post a Comment