java


Time controls in Android


I'm building my Main() method for a game I am developing in Eclipse, and I wanted to know if there are any time related classes already created in the Android SDK.
What I wanted to do was to make my Main() method loop through a While loop then wait 100 milliseconds, then loop again. I just need to know how I could make the loop wait.
Try this code. You can read more about the Java timer API here.
import java.util.Timer;
...
int delay = 0; // initial delay
int period = 100; // repeat every 100 ms
new Timer().scheduleAtFixedRate(new TimerTask() {
public void run() {
// Your while loop goes here
}
}, delay, period);

Related Links

Adding rows to a JTable
How to register a JavaScript callback in a Java Applet?
Pattern for connecting to different databases using JDBC
SecureRandom: init once or every time it is needed?
Connecting to SQLServer using JDBC-ODBC Bridge
Fastest way to determine if an integer's square root is an integer
What package naming convention do you use for personal/hobby projects in Java? [closed]
protobuf serialization of language specific data structures
Embedding web browser window in Java
Convert Midi Note Numbers To Name and Octave
Should we declare a public constructor when the class is declared as package private?
BIRT in a desktop application
How do I interpret a WSDL with references to a namespace java: on a non-java client?
javac error “code too large”?
WebSphere Portal v.5.1 and AJP?
Why does addition of long variables cause concatenation?

Categories

HOME
testng
wso2
atom-editor
webpack
zeromq
gremlin
ngrx
drivers
google-play
google-api-php-client
nullpointerexception
webstorm
gis
rdf
c#-2.0
gps
win32gui
azure-storage-tables
constraint-programming
android-youtube-api
session-variables
google-translate
communication
midi
kentor-authservices
orchardcms
percona
windows-7-x64
serilog
undefined
evopdf
code-review
firefox-webextensions
xlsxwriter
opencover
functional-testing
graphicsmagick
kvc
cultureinfo
hammerspoon
fish
centos6.5
applozic
libssl
react-chartjs
uisplitview
grails-3.1
kendo-ui-grid
fusionpbx
jmonkeyengine
adobe-premiere
hockeyapp
vapor
broadcastreceiver
avro4s
estimote
midl
businessworks
convertapi
btrace
avconv
xml-documentation
parentheses
strptime
dds
pebble-watch
darcs
pg-dump
akka-cluster
dynamics-sl
objective-c-swift-bridge
ableton-live
android-textview
storekit
connect-by
bluemix-app-scan
bluegiga
pagerank
cloudbees
tcpserver
srand
intel-fortran
intellij-14
pundit
coveralls
embedded-code
e10s
operator-precedence
tt-news
relocation
websocket4net
project-planning
comexception
mechanize-ruby
ember-charts
message-driven-bean
jsctypes
runtime.exec
padarn
plasma
wsdl-2.0
anonymous-methods
mhtml
sublist
appconkit
hgsubversion
netdna-api
servicehost
winbugs14
disclosure
fluent-interface
routedevent
meego
data-driven
xetex
msdev
wsdl.exe
commodore

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App