title: Renaming selected image from gallery
body: <p>I'm trying to make an app where user selects an Image from gallery and can rename it to desired name,
  The code to get the Image from gallery is</p>
  
  <pre><code>Intent photoPickerIntent = new Intent(Intent.ACTION_PICK);
              photoPickerIntent.setType("image/*");
              startActivityForResult(photoPickerIntent, RESULT_LOAD_IMG);
  
  @Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
  
      if (resultCode == RESULT_OK){
          try {
              upload.setVisibility(View.INVISIBLE);
              Image.setVisibility(View.VISIBLE);
              final Uri imageUri = data.getData();
              final InputStream imageStream = getContentResolver().openInputStream(imageUri);
              final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
  
              Image.setImageBitmap(selectedImage);
              Log.i("FileName is", fileName);
          } catch (FileNotFoundException e){
              e.printStackTrace();
              Toast.makeText(getApplicationContext(),"Error Loading Image",Toast.LENGTH_LONG).show();
          }
      } else {
          Toast.makeText(getApplicationContext(),"Please select an image",Toast.LENGTH_LONG).show();
      }
  }
  </code></pre>
  
  <p>I've seen some posts which use <code>from</code> and <code>to</code> to rename Images but I'm not able to understand how it works and how to set a desired name(which will be entered by user via an editText).</p>
  
  <p>Any help would be appreciated</p>