TimerThread timer;
Timer delay;
timer = new TimerThread();
delay = new Timer();
delay.schedule(timer,30000, 30000);
class TimerThread extends TimerTask{
@Override
public void run() {
if(flag){
doWork();
}else{
finish();
}
}
}
public void doWork() {
runOnUiThread(new Runnable() {
public void run() {
try{
write ur data-----
}
catch(Exception e)
{
System.out.println("Error-=-on thread="+e);
}
}
});
}
No comments:
Post a Comment