title: I am unable to load two different pictures in two different Image Views
body: <p>What should happen:</p>
  <ul>
  <li>User should be able to upload a picture into Image View_1.</li>
  <li>User should be able to upload a picture into Image View_2.</li>
  <li>Two distinct pictures should display at the same time.</li>
  </ul>
  <p>What is actually happening:</p>
  <ul>
  <li>If user uploads a picture into Image View_1, then Image View_1 and Image View_2 change to the same picture.</li>
  <li>If user uploads a picture into Image View_2, then Image View_2 and Image View_1 change to the  same picture.</li>
  </ul>
  <pre><code>
  import androidx.annotation.NonNull;
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.appcompat.widget.Toolbar;
  
  import com.google.android.gms.tasks.OnCompleteListener;
  import com.google.android.gms.tasks.OnSuccessListener;
  import com.google.android.gms.tasks.Task;
  import com.google.firebase.auth.FirebaseAuth;
  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.Picasso;
  import com.theartofdev.edmodo.cropper.CropImage;
  import com.theartofdev.edmodo.cropper.CropImageView;
  
  import android.content.Intent;
  import android.net.Uri;
  import android.os.Bundle;
  import android.view.View;
  import android.widget.ImageButton;
  import android.widget.ImageView;
  import android.widget.ProgressBar;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import de.hdodenhof.circleimageview.CircleImageView;
  
  
  public class Personal_Wall_Edit extends AppCompatActivity {
      private String currentUserID;
      private DatabaseReference UsersReference;
      private CircleImageView profile_image;
      private StorageReference UserProfileImageRef;
      private FirebaseAuth mAuth;
      private ImageButton edit_banner_button;
      private ImageButton edit_profile_button;
      private ProgressBar mProgressBar;
      private ImageView bannerimage;
      private StorageReference UserBannerImageRef;
      private DatabaseReference mDatabaseRef;
      final static int Gallery_Pick = 1;
      final static int Gallery_Pick2 = 2;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_personal__wall__edit);
          Toolbar toolbar = findViewById(R.id.toolbar2);
          setSupportActionBar(toolbar);
          getSupportActionBar().setTitle(&quot;Back to Profile&quot;);
          getSupportActionBar().setLogo(R.drawable.ic_arrow_left_black);
          toolbar.setClickable(true); //this tells our system to actually use the toolbar as the actionbar.
          mAuth = FirebaseAuth.getInstance();
          currentUserID = mAuth.getCurrentUser().getUid();
          UsersReference = FirebaseDatabase.getInstance().getReference().child(&quot;Users&quot;).child(currentUserID);
          edit_banner_button = findViewById(R.id.edit_profile_banner_button);
          edit_profile_button = findViewById(R.id.edit_profile_pic_button);
          mDatabaseRef = FirebaseDatabase.getInstance().getReference(&quot;uploads&quot;);
  
  
          //Banner Image Section for Firebase//
          UserBannerImageRef = FirebaseStorage.getInstance().getReference().child(&quot;bannerimages&quot;);
          bannerimage = findViewById(R.id.temporary_banner_edit);
          //Banner Image Section for Firebase//
  
  
          //Profile Image Section for Firebase//
          UserProfileImageRef = FirebaseStorage.getInstance().getReference().child(&quot;profileimage&quot;);
          profile_image = findViewById(R.id.profile_place_holder_edit);
          //Profile Image Section for Firebase//
  
  
  
  
  
  
          /////Profile Banner Editing//////////////////////////////////////////////////////
  
          edit_banner_button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent galleryIntent = new Intent();
                  galleryIntent.setAction(Intent.ACTION_GET_CONTENT);
                  galleryIntent.setType(&quot;image/*&quot;); //this will only choose images from the gallery and not videos, etc...//
                  startActivityForResult(galleryIntent, Gallery_Pick);
  
              }
          });
  
          /////Profile Banner Editing//////////////////////////////////////////////////////
  
  
  
  
  
  
  
  
  
  
          /////Profile Picture Editing//////////////////////////////////////////////////////
          edit_profile_button.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Intent galleryIntent2 = new Intent();
                  galleryIntent2.setAction(Intent.ACTION_GET_CONTENT);
                  galleryIntent2.setType(&quot;image/*&quot;); //this will only choose images from the gallery and not videos, etc...//
                  startActivityForResult(galleryIntent2, Gallery_Pick2);
  
              }
          });
  
  
          /////Profile Picture Editing//////////////////////////////////////////////////////
  
  
  
  
  
  
  
  
  
  
          // (Below) In the toolbar, there is a button that will send the user back to the profile page from the edit profile page.//
          toolbar.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Send_User_Back_to_Profile_Page_View_Activity();
  
              }
          });
          // (Above) In the toolbar, there is a button that will send the user back to the profile page from the edit profile page.//
  
  
  
  
  
  
  
  
          //(Below) This should pull in the profile picture was taken on the ad-more_info after registration page//
          UsersReference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                  if (dataSnapshot.exists()) {
  
                      String myProfileImage = dataSnapshot.child(&quot;profileimage&quot;).getValue().toString();
                      Picasso.get().load(myProfileImage).placeholder(R.drawable.profile_place_holder).into(profile_image);
  
  
                  }
  
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              } //Above is the Value Event Listener. This is what you can use to retrieve data (or in this case- images that have already been stored into the Firebase Database.//
  
          });
          // (Above) This should pull in the profile picture was taken on the ad-more_info after registration page//
  
  
  ////////[BANNERE-PICTURE]-Below is the method for saving the Banner Image- like retrieving it from Firebase//
          UsersReference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                  if (dataSnapshot.exists()) {
                      if (dataSnapshot.hasChild(&quot;banner_images&quot;)) {
  
                          String myBannerImage = dataSnapshot.child(&quot;banner_images&quot;).getValue().toString();
                          Picasso.get().load(myBannerImage).placeholder(R.drawable.ic_hapana_banner_2).into(bannerimage);
  
  
                      } else {
                          Toast.makeText(Personal_Wall_Edit.this, &quot;Please select profile image first.&quot;, Toast.LENGTH_SHORT).show();
                      }
                  }
  
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              } //Above is the Value Event Listener. This is what you can use to retrieve data (or in this case- images that have already been stored into the Firebase Database.//
  
          });
          /////[BANNER_PICTURE]-(Above) This should pull in the banner picture that the user selected//
  
  
  
  
  
  
  
  
  
          ////////[PROFILE_PICTURE]-Below is the method for saving the Profile Image- like retrieving it from Firebase//
          UsersReference.addValueEventListener(new ValueEventListener() {
              @Override
              public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
                  if (dataSnapshot.exists()) {
                      if (dataSnapshot.hasChild(&quot;profileimage&quot;)) {
  
                          String myProfileImage = dataSnapshot.child(&quot;profileimage&quot;).getValue().toString();
                          Picasso.get().load(myProfileImage).placeholder(R.drawable.profile_place_holder).into(profile_image);
  
  
                      } else {
                          Toast.makeText(Personal_Wall_Edit.this, &quot;Error&quot;, Toast.LENGTH_SHORT).show();
                      }
                  }
  
  
              }
  
              @Override
              public void onCancelled(@NonNull DatabaseError databaseError) {
  
              } //Above is the Value Event Listener. This is what you can use to retrieve data (or in this case- images that have already been stored into the Firebase Database.//
  
          });
          //////[PROFILE_PICTURE]- (Above) This should pull in the Profile picture that the user selected//
  
  
      }
  
  
  
  
  
  
  
  
  
  //////Sending User Back To the Personal Wall Activity////////////////////////////////////////////////////////
      private void Send_User_Back_to_Profile_Page_View_Activity() {
          Intent send_back_profile_page = new Intent(Personal_Wall_Edit.this, Personal_Wall.class);
          startActivity(send_back_profile_page);
          finish();
      }
  
  //////Sending User Back To the Personal Wall Activity////////////////////////////////////////////////////////
  
  
  
  
  
  
  
  
  
  
  
  
      //////Adding [BANNER/PROFILE PICTURE] to Firebase Database and Displaying it On the Page/////////////////////////////
      @Override
      protected void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == Gallery_Pick &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null) {
              Uri imageUri = data.getData();
  
  
              CropImage.activity(imageUri)
                      .setGuidelines(CropImageView.Guidelines.ON)
                      .setAspectRatio(1, 1)
                      .start(this);
  
  
          }
  
          // when pressing the crop button//
          if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
              CropImage.ActivityResult result = CropImage.getActivityResult(data);
  
              if (resultCode == RESULT_OK) {
  
  
                  Uri resultUri = result.getUri();
  
  
                  StorageReference filePath = UserBannerImageRef.child(currentUserID + &quot;.jpg&quot;);
  
  
                  filePath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener&lt;UploadTask.TaskSnapshot&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;UploadTask.TaskSnapshot&gt; task) {
                          if (task.isSuccessful()) {
  
                              Toast.makeText(Personal_Wall_Edit.this, &quot;Image has been added sucessfully...&quot;, Toast.LENGTH_SHORT).show();
                              Task&lt;Uri&gt; result = task.getResult().getMetadata().getReference().getDownloadUrl();
  
                              result.addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
                                  @Override
                                  public void onSuccess(Uri uri) {
                                      final String downloadUrl = uri.toString();
  
  
                                      UsersReference.child(&quot;banner_images&quot;).setValue(downloadUrl)
                                              .addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                                                  @Override
                                                  public void onComplete(@NonNull Task&lt;Void&gt; task) {
                                                      if (task.isSuccessful()) {
  
  
                                                          Toast.makeText(Personal_Wall_Edit.this, &quot;Image has been stored...&quot;, Toast.LENGTH_SHORT).show();
                                                      } else {
                                                          String message = task.getException().getMessage();
                                                          Toast.makeText(Personal_Wall_Edit.this, &quot;Error: &quot; + message, Toast.LENGTH_SHORT).show();
                                                      }
  
                                                  }
  
  
                                              });
                                  }
  
                              });
                          }
                      }
                  });
  
              } else {
                  Toast.makeText(Personal_Wall_Edit.this, &quot;Error: Image did not upload. Please try again.&quot;, Toast.LENGTH_SHORT).show();
  
              }
  
  
          }
  
  
  
  
  
  
          //////////////////////////PROFILE_PICTURE_SECTION////////////////////////////////////////////
          else if (requestCode == Gallery_Pick2 &amp;&amp; resultCode == RESULT_OK &amp;&amp; data != null) {
              Uri imageUri = data.getData();
  
  
              CropImage.activity(imageUri)
                      .setGuidelines(CropImageView.Guidelines.ON)
                      .setAspectRatio(1, 1)
                      .start(this);
  
  
          }
  
  
  
          // when pressing the crop button//
          if (requestCode == CropImage.CROP_IMAGE_ACTIVITY_REQUEST_CODE) {
              CropImage.ActivityResult result = CropImage.getActivityResult(data);
  
  
              if (resultCode == RESULT_OK) {
  
  
                  Uri resultUri = result.getUri();
  
  
                  StorageReference filePath = UserProfileImageRef.child(currentUserID + &quot;.jpg&quot;);
  
                  filePath.putFile(resultUri).addOnCompleteListener(new OnCompleteListener&lt;UploadTask.TaskSnapshot&gt;() {
                      @Override
                      public void onComplete(@NonNull Task&lt;UploadTask.TaskSnapshot&gt; task) {
                          if (task.isSuccessful()) {
  
                              Toast.makeText(Personal_Wall_Edit.this, &quot;Image has been added sucessfully...&quot;, Toast.LENGTH_SHORT).show();
                              Task&lt;Uri&gt; result = task.getResult().getMetadata().getReference().getDownloadUrl();
  
                              result.addOnSuccessListener(new OnSuccessListener&lt;Uri&gt;() {
                                  @Override
                                  public void onSuccess(Uri uri) {
                                      final String downloadUrl = uri.toString();
  
  
                                      UsersReference.child(&quot;profileimage&quot;).setValue(downloadUrl)
                                              .addOnCompleteListener(new OnCompleteListener&lt;Void&gt;() {
                                                  @Override
                                                  public void onComplete(@NonNull Task&lt;Void&gt; task) {
                                                      if (task.isSuccessful()) {
  
                                                          Toast.makeText(Personal_Wall_Edit.this, &quot;Image has been stored...&quot;, Toast.LENGTH_SHORT).show();
                                                      } else {
                                                          String message = task.getException().getMessage();
                                                          Toast.makeText(Personal_Wall_Edit.this, &quot;Error: &quot; + message, Toast.LENGTH_SHORT).show();
                                                      }
  
                                                  }
  
  
                                              });
                                  }
                              });
                          }
                      }
                  });
              } else {
                  Toast.makeText(Personal_Wall_Edit.this, &quot;Error: Image did not upload. Please try again.&quot;, Toast.LENGTH_SHORT).show();
              }
          }
  
  
      }
  }
  
      //////Adding [BANNER/PROFILE_PICTURE] to Firebase Database and Displaying it On the Page/////////////////////////////
  </code></pre>