java - Pause or sleep AsyncTask without affect to UI -
can sleep or stop asyctask's execution without affect ui? there way other creating new thread achieve (i sure doesn't affect ui though)?
explanation:
public class myasync extends asynctask<....>{ @override ..doinbackground(){ //do for(....){ //sleep asynctask //i want delay loop } //do } } creating new thread isn't want follow:
//inside doinbackground() new thread(new runnable(){ @override public run(){ for(..){ thread.sleep(1000);//sleeping 1 second } } }); //other parts p.s. using asynctask in service run in background every n seconds.
if call thread.sleep(1000) inside doinbackground() method, not affect ui since doinbackground() called on background thread.
Comments
Post a Comment