简体   繁体   中英

Calling a Async task from a service in android

Hello everybody I need help in calling a Asynctask from service

There is an Asynctask in my Main class extends with Fragment I want to call this Asynctask for every periodic interval time or when ever next update needed for this case I am thinking to implement services class in my application can any one guide me how can I achieve this

Thanks in Advance

Create a handler inside onCreate like this :

new Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
        }
    }, SPLASH_TIME_OUT);

here SPLASH_TIME_OUT is an integer which tells time to call this method again and again.

private static int SPLASH_TIME_OUT = 1500;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM