title: Image is uploaded to server but not shown in Imageview application android
body: <p>I have created photo uploading feature. User can take photo and choose a photo from a file and upload it to the Server.</p>
  
  <p>At this moment the photo is uploaded successfully to server. But when i look at my app, it is showing the old image. the image is not updated in the imageview in my app. I have heared about the shared preferance by which user can set their image as long as they want.</p>
  
  <p>I am using the Volley library to POST data from my app to upload the photo, and using the Glide library to download and show that photo into the app.</p>
  
  <p>I am giving a small portion of my code, which is related to photo uploading and downloading. Please help me to identify and solve the problem.</p>
  
  <pre><code>public void showDialog(){
          ........
          alertButton.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  alert.dismiss();
              }
          });
  
          alertListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view,
                                      int position, long id) {
                  // ListViekw Clicked item index
                  if (position == 0) {
  
                          cameraIntent();
  
                  }
                  else if (position == 1){
  
                          galleryIntent();
  
                  }
              }
          });
      }
  
  
      private void galleryIntent()
      {
          Intent intent = new Intent(Intent.ACTION_PICK);
          intent.setType("image/*");
          startActivityForResult(Intent.createChooser(intent, "Select File"),SELECT_FILE);
  
      }
  
      public void cameraIntent() {
          Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
          if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) {
              File cameraFolder;
              if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                  cameraFolder = new File(Environment.getExternalStorageDirectory(), "image/");
              } else {
                  cameraFolder = getActivity().getCacheDir();
              }
              if (!cameraFolder.exists()) {
                  cameraFolder.mkdirs();
              }
              String imageFileName = System.currentTimeMillis() + ".jpg";
              File photoFile = new File(cameraFolder + imageFileName);
              currentPhotoPath = photoFile.getAbsolutePath();
              if (photoFile != null) {
                  takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(photoFile));
                  startActivityForResult(takePictureIntent, REQUEST_CAMERA);
              }
          }
      }
  
      @Override
      public void onActivityResult(int requestCode, int resultCode, Intent data) {
          super.onActivityResult(requestCode, resultCode, data);
  
          if (resultCode == RESULT_OK) {
              if (requestCode == SELECT_FILE){
                  onSelectFromGalleryResult(data);
  
              }
  
              else if (requestCode == REQUEST_CAMERA) {
                  if (!TextUtils.isEmpty(currentPhotoPath)) {
                      galleryAddPic();
                      onCaptureImageResult();
                  }
              }
          }
      }
  
      private void galleryAddPic() {
          Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE);
          File f = new File(currentPhotoPath);
          Uri contentUri = Uri.fromFile(f);
          mediaScanIntent.setData(contentUri);
          this.getActivity().sendBroadcast(mediaScanIntent);
      }
  
      private void onCaptureImageResult() {
          Bitmap bitmap = getBitmapFromPath(currentPhotoPath, 200, 200);
          image.setImageBitmap(bitmap);
          compressBitMap(bitmap);
      }
  
      private void onSelectFromGalleryResult(Intent data) {
          ...
      }
  
  
      private void compressBitMap(Bitmap bitmap) {
         ...
      }
  
      public static Bitmap getBitmapFromPath(String photoPath, int targetW, int targetH) {
          ....
      }
  
      private void uploadImage(final byte[] bytesArray){
  
  
      }
  
  }
  </code></pre>