title: Images Not Showing After Saving/Sending to Firebase Database
body: <p>I'm trying to make a chat app, but i'm facing a problem. When i'm trying to upload a profile image and then store it in the firebase. The said image that i've uploaded always stored in the firebase, but the image is not showing in the app, only a blank white screen. This problem exists in every image-firebase related stuff in my project (because i keep reusing the same code over and over again). What's my mistake(s)? Is there's something i miss or did it wrong? Any kinds of help is welcome.</p>
  
  <p>I've attached some of my code and screenshot that might be related to my problem</p>
  
  <ol>
  <li>ProfileActivity</li>
  </ol>
  
  <p>private final String TAG = "CA/ProfileActivity";</p>
  
  <pre><code>// // Will handle all changes happening in database
  
  private DatabaseReference userDatabase, requestsDatabase, friendsDatabase;
  private ValueEventListener userListener, requestsListener, friendsListerner;
  
  // Users data
  
  private String currentUserId, otherUserId;
  
  // activity_profile views
  
  private TextView name, status;
  private CircleImageView image;
  private KenBurnsView cover;
  private FABsMenu menu;
  private TitleFAB button1, button2, button3;
  
  @Override
  protected void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_profile);
  
      name = findViewById(R.id.profile_name);
      status = findViewById(R.id.profile_status);
      image = findViewById(R.id.profile_image);
      menu = findViewById(R.id.profile_fabs_menu);
      cover = findViewById(R.id.profile_cover);
  
      otherUserId = getIntent().getStringExtra("userid");
      currentUserId = FirebaseAuth.getInstance().getCurrentUser().getUid();
  }
  
  @Override
  protected void onStart()
  {
      super.onStart();
  
      if(userDatabase != null &amp;&amp; userListener != null)
      {
          userDatabase.removeEventListener(userListener);
      }
  
      // Initialize/Update realtime user data such as name, email, status, image
  
      userDatabase = FirebaseDatabase.getInstance().getReference().child("Users").child(otherUserId);
      userDatabase.keepSynced(true); // For offline use
      userListener = new ValueEventListener()
      {
          @Override
          public void onDataChange(DataSnapshot dataSnapshot)
          {
              try
              {
                  String layoutName = dataSnapshot.child("name").getValue().toString();
                  String layoutStatus = dataSnapshot.child("status").getValue().toString();
                  final String layoutImage = dataSnapshot.child("image").getValue().toString();
                  final String layoutCover = dataSnapshot.child("cover").getValue().toString();
  
                  name.setText(layoutName);
                  status.setText("\"" + layoutStatus + "\"");
  
                  if(!layoutImage.equals("default"))
                  {
                      Picasso.get()
                              .load(layoutImage)
                              .resize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics()))
                              .centerCrop()
                              .networkPolicy(NetworkPolicy.OFFLINE)
                              .placeholder(R.drawable.user)
                              .error(R.drawable.user)
                              .into(image, new Callback()
                              {
                                  @Override
                                  public void onSuccess()
                                  {
  
                                  }
  
                                  @Override
                                  public void onError(Exception e)
                                  {
                                      Picasso.get()
                                              .load(layoutImage)
                                              .resize((int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics()), (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 180, getResources().getDisplayMetrics()))
                                              .centerCrop()
                                              .placeholder(R.drawable.user)
                                              .error(R.drawable.user)
                                              .into(image);
                                  }
                              });
  
                      image.setOnClickListener(new View.OnClickListener()
                      {
                          @Override
                          public void onClick(View view)
                          {
                              Intent intent = new Intent(ProfileActivity.this, FullScreenActivity.class);
                              intent.putExtra("imageUrl", layoutImage);
                              startActivity(intent);
                          }
                      });
                  }
                  else
                  {
                      image.setImageResource(R.drawable.user);
                  }
  
                  if(!layoutCover.equals("default"))
                  {
                      Picasso.get()
                              .load(layoutCover)
                              .resize(getResources().getDisplayMetrics().widthPixels, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 260, getResources().getDisplayMetrics()))
                              .centerCrop()
                              .networkPolicy(NetworkPolicy.OFFLINE)
                              .placeholder(R.drawable.logo_cover)
                              .error(R.drawable.logo_cover)
                              .into(cover, new Callback()
                              {
                                  @Override
                                  public void onSuccess()
                                  {
  
                                  }
  
                                  @Override
                                  public void onError(Exception e)
                                  {
                                      Picasso.get()
                                              .load(layoutCover)
                                              .resize(getResources().getDisplayMetrics().widthPixels, (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 260, getResources().getDisplayMetrics()))
                                              .centerCrop()
                                              .placeholder(R.drawable.logo_cover)
                                              .error(R.drawable.logo_cover)
                                              .into(cover);
                                  }
                              });
                  }
                  else
                  {
                      cover.setImageResource(R.drawable.logo_cover);
                  }
              }
              catch(Exception e)
              {
                  Log.d(TAG, "userDatabase listener exception: " + e.getMessage());
                  e.printStackTrace();
              }
          }
  
          @Override
          public void onCancelled(DatabaseError databaseError)
          {
              Log.d(TAG, "userDatabase listener failed: " + databaseError.getMessage());
          }
      };
      userDatabase.addValueEventListener(userListener);
  
      if(otherUserId.equals(currentUserId))
      {
          initMyProfile();
      }
      else
      {
          initOtherProfile();
      }
  }
  
  @Override
  protected void onResume()
  {
      super.onResume();
  
      FirebaseDatabase.getInstance().getReference().child("Users").child(currentUserId).child("online").setValue("true");
  }
  
  @Override
  protected void onPause()
  {
      super.onPause();
  
      FirebaseDatabase.getInstance().getReference().child("Users").child(currentUserId).child("online").setValue(ServerValue.TIMESTAMP);
  }
  
  @Override
  protected void onStop()
  {
      super.onStop();
  
      removeListeners();
  }
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, final Intent data)
  {
      super.onActivityResult(requestCode, resultCode, data);
  
      if(requestCode == 1 &amp;&amp; resultCode == RESULT_OK)
      {
          Uri url = data.getData();
  
          //Uploading selected picture
  
          StorageReference file = FirebaseStorage.getInstance().getReference().child("profile_images").child(currentUserId + ".jpg");
          file.putFile(url).addOnCompleteListener(new OnCompleteListener&lt;UploadTask.TaskSnapshot&gt;()
          {
              @Override
              public void onComplete(@NonNull Task&lt;UploadTask.TaskSnapshot&gt; task)
              {
                  if(task.isSuccessful())
                  {
                      String imageUrl = task.getResult().toString();
  
                      // Updating image on user data
  
                      userDatabase.child("image").setValue(imageUrl).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;()
                      {
                          @Override
                          public void onComplete(@NonNull Task&lt;Void&gt; task)
                          {
                              if(task.isSuccessful())
                              {
                                  Toast.makeText(ProfileActivity.this, "Picture updated", Toast.LENGTH_SHORT).show();
                              }
                              else
                              {
                                  Log.d(TAG, "updateImage listener failed: " + task.getException().getMessage());
                              }
                          }
                      });
                  }
                  else
                  {
                      Log.d(TAG, "uploadImage listener failed: " + task.getException().getMessage());
                  }
              }
          });
      }
      else if(requestCode == 2 &amp;&amp; resultCode == RESULT_OK)
      {
          Uri url = data.getData();
  
          //Uploading selected cover picture
  
          StorageReference file = FirebaseStorage.getInstance().getReference().child("profile_covers").child(currentUserId + ".jpg");
          file.putFile(url).addOnCompleteListener(new OnCompleteListener&lt;UploadTask.TaskSnapshot&gt;()
          {
              @Override
              public void onComplete(@NonNull Task&lt;UploadTask.TaskSnapshot&gt; task)
              {
                  if(task.isSuccessful())
                  {
                      String imageUrl = task.getResult().toString();
  
                      // Updating image on user data
  
                      userDatabase.child("cover").setValue(imageUrl).addOnCompleteListener(new OnCompleteListener&lt;Void&gt;()
                      {
                          @Override
                          public void onComplete(@NonNull Task&lt;Void&gt; task)
                          {
                              if(task.isSuccessful())
                              {
                                  Toast.makeText(ProfileActivity.this, "Cover updated", Toast.LENGTH_SHORT).show();
                              }
                              else
                              {
                                  Log.d(TAG, "updateUserCover listener failed: " + task.getException().getMessage());
                              }
                          }
                      });
                  }
                  else
                  {
                      Log.d(TAG, "uploadCover listener failed: " + task.getException().getMessage());
                  }
              }
          });
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <ol start="2">
  <li>FullscreenActivity</li>
  </ol>
  
  <p>public class FullScreenActivity extends AppCompatActivity
  {
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_full_screen);</p>
  
  <pre><code>    final String url = getIntent().getStringExtra("imageUrl");
  
      final ImageView image= findViewById(R.id.a_fullscreen_image);
      final TextView message = findViewById(R.id.a_fullscreen_message);
  
      message.setText("Loading Picture...");
      message.setVisibility(View.VISIBLE);
  
      Picasso.get()
              .load(url)
              .networkPolicy(NetworkPolicy.OFFLINE)
              .into(image, new Callback()
              {
                  @Override
                  public void onSuccess()
                  {
                      message.setVisibility(View.GONE);
                  }
  
                  @Override
                  public void onError(Exception e)
                  {
                      Picasso.get()
                              .load(url)
                              .into(image, new Callback()
                              {
                                  @Override
                                  public void onSuccess()
                                  {
                                      message.setVisibility(View.GONE);
                                  }
  
                                  @Override
                                  public void onError(Exception e)
                                  {
                                      message.setVisibility(View.VISIBLE);
                                      message.setText("Error: Could not load picture.");
                                  }
                              });
                  }
              });
  
  }
  </code></pre>
  
  <p>}</p>
  
  <ol start="3">
  <li>Firebase rules</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/8FkBI.png" rel="nofollow noreferrer">firebase rules</a></p>
  
  <ol start="4">
  <li>The aforementioned problem in the app</li>
  </ol>
  
  <p><a href="https://i.stack.imgur.com/XnEHw.png" rel="nofollow noreferrer">the output for the fullscreen activity</a></p>
  
  <p><a href="https://i.stack.imgur.com/oNU9D.png" rel="nofollow noreferrer">the output for the chat</a>
  (images supposed to be showing)</p>
  
  <p><a href="https://i.stack.imgur.com/uOhPH.png" rel="nofollow noreferrer">the output for the profile activity</a>
  (the profile picture supposed to be different image that i uploaded earlier not the default one)</p>
  
  <ol start="5">
  <li><a href="https://i.stack.imgur.com/xGyCP.png" rel="nofollow noreferrer">Stored images in firebase</a></li>
  </ol>