I need to pass two params (lv and position) to a Asynctask doInBackground method but I don’t know how do it…
LoadSound.execute(lv,position)
class LoadSound extends AsyncTask<**[ListView,int]**, String, String>
thanks!
EDIT:
I have a listView. If you click in an item play sound (from Internet).
I would like show a progressDialog with Asynctask.
In the doInBackground method I have the itemOnClick:
HashMap<String, String> o = (HashMap<String, String>) lv.getItemAtPosition(position);
for this reason I need to pass lv and position.
try creating a constructor within your
AsyncTaskand whenever you create your object you can pass the parameters.Something like this:
and then you can just call
asynctask.execute();Edit: After reading your updated question I agree to Squonk to use a Service for example to play a background sound; also you can show a progress dialog before launching your AsynkTask (if this one is indefinetly) and dismiss it on your postexecute.