Load Image From Web url in Android or Android Studio

Here, is the tutorial for image url in to the your mobile app.
There are two method, you can choose as your requirement ,  Aquey or direct image load,

1. Image load using direct url

First you have defined , imageview and then load image url in that imageview.

private Bitmap bitmapImage;
private ImageView imageView;
private ProgressDialog pdDialog;

private String imageUrl=""https://www.....png";

In onCreate:

imageView= (ImageView)findViewById(R.id.imgView);
new LoadImageFromUrl ().execute(imageUrl);

now defined LoadImageFromUrl, outsite the onCreate:

 private class LoadImageFromUrl extends AsyncTask<String, String, Bitmap> {
        protected void onPreExecute() {
            pdDialog = new ProgressDialog(MainActivity.this);
            pdDialog.setMessage("Loading Image From URL ....");

         protected Bitmap doInBackground(String... args) {
             try {
                   bitmap = BitmapFactory.decodeStream((InputStream)new URL(args[0]).getContent());

            } catch (Exception e) {
            return bitmap;

         protected void onPostExecute(Bitmap image) {

             if(image != null){


             Toast.makeText(MainActivity.this, "Image Does Not exist in such url or Network Error", Toast.LENGTH_SHORT).show();


2. Image Load using Aquery

import com.androidquery.AQuery;

public class AQueryImageLoading extends Activity {
     private AQuery aq;
    ProgressDialog pDialog;
private String imageUrl=""https://www.....png";
    public void onCreate(Bundle savedInstanceState) {
        aq = new AQuery(this);
               aq.id(R.id.loadProgressDialogBtn).text("Load Image with progress dialog bar").clicked(this, "loadImageFromInternetWithProgressDialogBar");
    // Call back method for Button - R.id.loadProgressDialogBtn click
    public void loadImageFromInternetWithProgressDialogBar(View image) {
        pDialog= new ProgressDialog(this);
        pDialog.setMessage("Downloading Image from Internet. Please wait...");
        Toast.makeText(aq.getContext(), "Download initiated...",Toast.LENGTH_SHORT).show();
        // Display Progress Dialog Bar by invoking progress method


Happy Coding !!!


Most recent Elastic Search tutorials for beginner, intermediate and advance level developer, Yubraj Pokharel, in CodingWorkspace