title: Image not loading with picasso..keeps displaying blank image
body: <p>I'm trying to load an image from firebase real time database using picasso, but it keeps displaying blank image... I got the same result when I tried using Glide.
  I tried to use this solution : <a href="https://stackoverflow.com/questions/54293600/image-not-loading-with-picasso-or-glide-keeps-displaying-black-background">Image not loading with picasso or glide..keeps displaying black background</a> But it doesn't work for me</p>
  
  <p>Here's the code :</p>
  
  <p>activity_profile_info.xml</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      xmlns:tools="http://schemas.android.com/tools"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      android:id="@+id/activity_profile"
      android:orientation="vertical"
      tools:context="com.example.schooltest.ProfileInfoActivity"&gt;
  
      &lt;include layout="@layout/toolbar"/&gt;
  
      &lt;View
          android:id="@+id/view"
          android:layout_width="match_parent"
          android:layout_height="280dp"
          android:layout_alignParentStart="true"
          android:layout_alignParentTop="true"
          android:layout_marginBottom="50dp"
          android:background="#11032E" /&gt;
  
      &lt;ScrollView
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:id="@+id/scrollView_account"&gt;
  
          &lt;RelativeLayout
              android:id="@+id/linear_account"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:layout_marginTop="190dp"
                  android:orientation="vertical"&gt;
  
                  &lt;LinearLayout
                      android:layout_width="match_parent"
                      android:layout_height="match_parent"
                      android:layout_marginLeft="10dp"
                      android:layout_marginRight="10dp"
                      android:layout_marginTop="100dp"
                      android:orientation="vertical"&gt;
  
                      &lt;TextView
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:layout_marginTop="10dp"
                          android:text="@string/profile_details"
                          android:textStyle="bold"
                          android:textSize="20sp"/&gt;
  
                      &lt;com.google.android.material.textfield.TextInputLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:textColorHint="@color/edit_text_bg"&gt;
  
                          &lt;EditText
                              android:id="@id/et_name"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:hint="@string/name"
                              android:imeOptions="actionNext"
                              android:textColorHint="@color/edit_text_bg"/&gt;
  
                      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
                      &lt;com.google.android.material.textfield.TextInputLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:textColorHint="@color/edit_text_bg"&gt;
  
                          &lt;EditText
                              android:id="@+id/et_email_address"
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:hint="@string/email_address_hint"
                              android:imeOptions="actionNext"
                              android:textColorHint="@color/edit_text_bg"/&gt;
  
                      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
                      &lt;com.google.android.material.textfield.TextInputLayout
                          android:layout_width="match_parent"
                          android:layout_height="wrap_content"
                          android:textColorHint="@color/edit_text_bg"&gt;
  
                          &lt;EditText
                              android:layout_width="match_parent"
                              android:layout_height="wrap_content"
                              android:hint="@string/tel_number"
                              android:imeOptions="actionNext"
                              android:textColorHint="@color/edit_text_bg"/&gt;
  
                      &lt;/com.google.android.material.textfield.TextInputLayout&gt;
  
  
                  &lt;/LinearLayout&gt;
              &lt;/LinearLayout&gt;
  
              &lt;RelativeLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginTop="50dp"
                  android:layout_alignParentTop="true"
                  android:layout_alignParentStart="true"&gt;
  
                  &lt;de.hdodenhof.circleimageview.CircleImageView
                      android:id="@+id/circle_image"
                      android:layout_width="150dp"
                      android:layout_height="150dp"
                      android:layout_alignParentTop="true"
                      android:layout_centerHorizontal="true"
                      android:layout_marginTop="24dp"
                      android:hapticFeedbackEnabled="false"
                      app:civ_border_color="#92FFFFFF"
                      app:civ_border_width="2dp"
                      android:src="@drawable/avatar"
                      android:clickable="true"
                      android:focusable="true" /&gt;
  
                  &lt;TextView
                      android:id="@+id/name"
                      android:layout_width="wrap_content"
                      android:layout_height="wrap_content"
                      android:text="@string/name"
                      android:layout_marginTop="16dp"
                      android:layout_marginBottom="16dp"
                      android:textSize="20sp"
                      android:textColor="#92FFFFFF"
                      android:textStyle="bold"
                      android:layout_centerHorizontal="true"
                      android:layout_below="@id/circle_image"/&gt;
  
              &lt;/RelativeLayout&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/ScrollView&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>ProfileInfoActivity</p>
  
  <pre><code>import android.app.ProgressDialog;
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.preference.PreferenceFragment;
  import android.util.TypedValue;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.EditText;
  import android.widget.LinearLayout;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.ActionBar;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  
  import com.bumptech.glide.Glide;
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.FirebaseAuth;
  import com.google.firebase.auth.FirebaseUser;
  import com.google.firebase.database.DataSnapshot;
  import com.google.firebase.database.DatabaseError;
  import com.google.firebase.database.DatabaseReference;
  import com.google.firebase.database.FirebaseDatabase;
  import com.google.firebase.database.ValueEventListener;
  import com.google.firebase.storage.FirebaseStorage;
  import com.google.firebase.storage.StorageReference;
  import com.google.firebase.storage.UploadTask;
  import com.squareup.picasso.NetworkPolicy;
  import com.squareup.picasso.Picasso;
  import com.theartofdev.edmodo.cropper.CropImage;
  
  import java.io.File;
  import java.util.Random;
  
  import de.hdodenhof.circleimageview.CircleImageView;
  
  public class ProfileInfoActivity extends AppCompatActivity {
  
  
      private DatabaseReference mDatabaseReference;
      private FirebaseUser mCurrentUser;
  
      private CircleImageView mDisplayImage;
      private TextView mName;
      private EditText mEditName, mEmail;
  
      private static final int GALLERY_PICK = 1;
  
      private StorageReference mImageStorage;
  
      private ProgressDialog mProgressDialog;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_profile_info);
  
          mDisplayImage = findViewById(R.id.circle_image);
          mName = findViewById(R.id.name);
          mEditName = findViewById(R.id.et_name);
          mEmail = findViewById(R.id.et_email_address);
  
          mImageStorage = FirebaseStorage.getInstance().getReference();
  
          mCurrentUser = FirebaseAuth.getInstance().getCurrentUser();
  
          String userID = mCurrentUser.getUid();
  
          mDatabaseReference = FirebaseDatabase.getInstance().getReference().child("Users").child(userID);
          mDatabaseReference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
  
                  String name = dataSnapshot.child("name").getValue().toString();
                  String et_name = dataSnapshot.child("name").getValue().toString();
                  String et_email_adress = dataSnapshot.child("email").getValue().toString();
                  String image = dataSnapshot.child("image").getValue().toString();
                  String thumb_image = dataSnapshot.child("thumb_image").getValue().toString();
  
                  mName.setText(name);
                  mEditName.setText(et_name);
                  mEmail.setText(et_email_adress);
  
                  Picasso.get().load(image).into(mDisplayImage);
  
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              }
          });
  
          mDisplayImage.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent galleryIntent = new Intent();
                  galleryIntent.setType("image/*");
                  galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
  
                  startActivityForResult(Intent.createChooser(galleryIntent, "SELECT IMAGE"), GALLERY_PICK);
              }
          });
      }
  
      @Override
      protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if(requestCode == GALLERY_PICK &amp;&amp; resultCode == RESULT_OK ) {
              Uri imageUri = data.getData();
  
              CropImage.activity(imageUri)
                      .setAspectRatio(1, 1)
                      .start(this);
  
              //Toast.makeText(ProfileInfoActivity.this, imageUri, Toast.LENGTH_SHORT).show();
          }
  
          if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
              CropImage.ActivityResult result = CropImage.getActivityResult(data);
              if (resultCode == RESULT_OK) {
  
                  mProgressDialog = new ProgressDialog(ProfileInfoActivity.this);
                  mProgressDialog.setTitle("Uploading Image...");
                  mProgressDialog.setMessage("Please wait while we upload and process the image");
                  mProgressDialog.setCanceledOnTouchOutside(false);
                  mProgressDialog.show();
  
  
                  Uri resultUri = result.getUri();
                  String current_user_id = mCurrentUser.getUid();
  
                  StorageReference filepath = mImageStorage.child("profile_images").child(current_user_id + ".jpg");
  
                  filepath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener&lt;UploadTask.TaskSnapshot&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;UploadTask.TaskSnapshot&gt; task) {
                          if(task.isSuccessful()){
  
                              String download_url = task.getResult().getStorage().getDownloadUrl().toString();
  
                              mDatabaseReference.child("image").setValue(download_url).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                                  @Override
                                  public void onComplete(@NonNull Task&lt;Void&gt; task) {
  
                                      if(task.isSuccessful()) {
                                          mProgressDialog.dismiss();
  
                                      }
  
                                  }
                              });
  
  
                          } else {
  
                              Toast.makeText(ProfileInfoActivity.this, "Error in uploading: ", Toast.LENGTH_SHORT).show();
                              mProgressDialog.dismiss();
  
                          }
                      }
                  });
  
              } else if (resultCode == CropImage.CROP_IMAGE_ACTIVITY_RESULT_ERROR_CODE) {
                  Exception error = result.getError();
              }
          }
      }
  
  
  }
  </code></pre>
  
  <p>Manifest</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.schooltest"&gt;
  
      &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
      &lt;uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/&gt;
      &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
  
      &lt;application
          android:allowBackup="true"
          android:icon="@mipmap/ic_launcher"
          android:label="@string/app_name"
          android:roundIcon="@mipmap/ic_launcher_round"
          android:supportsRtl="true"
          android:theme="@style/AppTheme"&gt;
          &lt;activity android:name=".ProfileInfoActivity" /&gt;
          &lt;activity android:name=".ResetPasswordActivity" /&gt;
          &lt;activity
              android:name=".MainActivity"
              android:label="@string/app_name"
              android:theme="@style/AppTheme.NoActionBar" /&gt;
          &lt;activity android:name=".login.LoginActivity" /&gt;
          &lt;activity android:name=".login.SignupActivity" /&gt;
          &lt;activity
              android:name=".FullscreenActivity"
              android:configChanges="orientation|keyboardHidden|screenSize"
              android:label="@string/app_name"
              android:theme="@style/FullscreenTheme"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
  
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
          &lt;activity
              android:name=".SettingsActivity"
              android:label="@string/setting"
              android:parentActivityName=".MainActivity"&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value=".MainActivity" /&gt;
          &lt;/activity&gt;
          &lt;activity android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
              android:theme="@style/Base.Theme.AppCompat"/&gt; &lt;!-- optional (needed if default theme has no action bar) --&gt;
  
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>PS : Also, when I upload an image from device, download url is getting as com.google.android.gms.tasks.zzu@6534db7.
  So, all details were uploaded into realtime database correctly except image url.</p>