I have a ListView in which each item represents a PDF file. When the user clicks on an item, the application must download the file on external storage. Now the download doe
I'd use an AsyncTask for that, and make the wheel appear / disappear in onPreCreate & onPostCreate
private class MyDownloader extends AsyncTask{
@Override
protected void onPreExecute() {
loader.setVisibility(View.VISIBLE);
}
@Override
protected File doInBackground(String... params) {
//Download and save file here, and return the result, which will be fed into the onPostExecute method
return file;
}
@Override
protected void onPostExecute(File file) {
super.onPostExecute(file);
loader.setVisibility(View.GONE);
}
}
Then start the task with new MyDownloader().execute("linktopdf"); or something like that (what you put in .execute will be fed into the doInBackground method)