title: How to prevent EditText from being cleared after choosing a photo
body: <p>i created a function that allows people to choose image from their gallery. While the function works, i realized that after choosing the image, the edit text in that activity is cleared. Is there a way to prevent the text from being cleared? Have tried the onSaveInstanceState but it did not work.</p>
  
  <p>These are code snippets for choosing the photo</p>
  
  <pre><code>@Override
  protected void onResume() {
      super.onResume();
  }
  
  private void selectPhoto() {
          if (getIntent().getExtras()!= null &amp;&amp; getIntent().getExtras().getBoolean("SelectImage")) {
              Intent intent = new Intent();
              intent.setType("image/*");
              //intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true);
          intent.setAction(Intent.ACTION_GET_CONTENT);
          startActivityForResult(intent, PICK_IMAGE_REQUEST);
          }
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (requestCode == PICK_IMAGE_REQUEST &amp;&amp; resultCode == RESULT_OK) {
              if (data != null &amp;&amp; data.getClipData() != null) {
                  int totalItems = data.getClipData().getItemCount();
  
                  for (int i = 0; i &lt; totalItems; i++) {
                      Uri imageUri = data.getClipData().getItemAt(i).getUri();
                      imageNameList.add(imageUri);
  
                  }
              } else if (data != null &amp;&amp; data.getData() != null) {
                  Uri imageUri = data.getData();
                  imageNameList.add(imageUri);
              }
          }
      }
  </code></pre>
  
  <p>Picture of Activity</p>
  
  <p><a href="https://i.stack.imgur.com/I8ts6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/I8ts6.png" alt="enter image description here"></a></p>