There are related questions, such as How can I pass in 2 parameters to a AsyncTask class? , but I ran into the difficulty of trying in vain to pass multiple primitives as pa
Another way: You just need add MyTask constructor in your MyTask class:
private class MyTask extends AsyncTask {
int foo;
long bar;
double arple;
MyTask(int foo, long bar, double arple) {
// list all the parameters like in normal class define
this.foo = foo;
this.bar = bar;
this.arple = arple;
}
...... // Here is doInBackground etc. as you did before
}
Then call
new MyTask(int foo, long bar, double arple).execute();
A second way like David Wasser's Answer.