Uploading/downloading data(images) from the server are time consuming tasks. So its always better to run the time consuming tasks in background thread besides on main UI thread. So that it does not block the user interface.
You should go for the AsynchTask
which will help you to implement the downloading data from the server in its three methods effectively which are :
doInBackground()
-invoked on the background thread immediately after onPreExecute()
finishes executing.
onPreExecute()
- which is invoked on the UI thread before the task is executed.
onPostExecute()
- invoked on the UI thread after the background computation finishes.
Check out the below Uploading Image on Server and Image Uploading
For Downloading image check below links
Hope this will guide you.