title: give a predefined size to the profile images of users like whatsapp
body: <p>I have an application in which users have the opportunity to upload images for their profile in the gallery.</p>
  
  <p>  To achieve this I save the path of the image in shared preferences and place the image uri in an imageView.</p>
  
  <p>  everything works fine but when users download images dimenssion variable imageView is not very pretty to see so I would like to give an image size to respect for the profile as whatsapp does so that all users have the same dimension for their profile image.</p>
  
  <p>  how can I implement this please?</p>
  
  <p>Here is what I did for selecting an image in the gallery</p>
  
  <pre><code>Intent intent;
              if (Build.VERSION.SDK_INT &lt; 19) {
                  intent = new Intent(Intent.ACTION_GET_CONTENT);
              } else {
                  intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                  intent.addCategory(Intent.CATEGORY_OPENABLE);
              }
              intent.setType("image/*");
              startActivityForResult(Intent.createChooser(intent, "Select Picture"), PICK_IMAGE);
  </code></pre>
  
  <p>And</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      if (requestCode == PICK_IMAGE) {
          if (resultCode == RESULT_OK) {
              if (data != null) {
                  mImageUri = data.getData();
  
                  SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
                  SharedPreferences.Editor editor = preferences.edit();
                  editor.putString("image", String.valueOf(mImageUri));
                  editor.commit();
  
                  imageView.setImageURI(mImageUri);
                  imageView.invalidate();
              }
          }
      }
  }
  </code></pre>