title: getting image name of image selected from gallery in android
body: <p>I have browsed image from gallery and set it to <code>ImageView</code> now I need to get image name of image that have been set in <code>ImageView</code>. I have attached my code below.</p>
  
  <pre><code>@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      Log.d("req","req"+requestCode);
      Log.d("res","res"+resultCode);
  
      if (requestCode == RESULT_LOAD_IMAGE &amp;&amp; resultCode == RESULT_OK &amp;&amp; null != data) {
          Uri selectedImage = data.getData();
          String[] filePathColumn = { MediaStore.Images.Media.DATA };
          Cursor cursor = getContentResolver().query(selectedImage,
                  filePathColumn, null, null, null);
          cursor.moveToFirst();
          int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
          String picturePath = cursor.getString(columnIndex);
          cursor.close();
          imageView = (ImageView) findViewById(R.id.imgView);
  
          imageView1 = (ImageView) findViewById(R.id.imgView1);
  
          if(browse == 1){
              imageView.setImageBitmap(BitmapFactory.decodeFile(picturePath));
          }
          if(browse == 2){
              imageView1.setImageBitmap(BitmapFactory.decodeFile(picturePath));
          }
          String resName = getResources().getResourceEntryName(R.id.imgView);
          Toast.makeText(getApplicationContext(), "BBB"+resName,Toast.LENGTH_LONG).show();
  
      }
  </code></pre>