It is recommended that whenever one wants to download any file from server whether it is song or any image , it must perform in the background either by using asynctask or using a thread.
Here, we are using Asynctask:-
- /**
- * Downloading file in background thread
- */
- boolean download = true;
- @Override
- protected String doInBackground(String... params)
- {
- File SDCardRoot = Environment.getExternalStorageDirectory(); // location where you want to store
- File directory = new File(SDCardRoot, "/my_folder/"); //create directory to keep your downloaded file
- if (!directory.exists())
- {
- directory.mkdir();
Here is not the end. Read the full article about How to download file from server in android at Findnerd.
No comments:
Post a Comment