Question

I am trying to develop an application that is already exist but for android OS. I faced a class that extends android.os.AsyncTask<Void, Void, Void>, because java does not have this class.

What I want is to do some functions in the background like this class do I think. So is there a thread or any class for that purpose or I just use Thread.sleep() method?

Was it helpful?

Solution

It would be wise to make your own Thread as a backgroundTask like in android's AsyncTask.

sample:

Thread d = new Thread(new Runnable() {

        @Override
        public void run() {
            //do background task here
        }
    });

    d.start(); //start the background task
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top