title: Using Kotlin to pass Image from ImageView to another Activity in Android
body: <p>How to pass Image selected in <code>ImageView</code> to another Activity in Android using <code>Kotlin</code> ?</p>
  
  <p>This is the way to select the Image inside the <code>ImageView</code> using internal Storage and I need to pass the image to another activity</p>
  
  <pre><code> fun Loadimage()
      {
           var intent = Intent(Intent.ACTION_PICK,android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
           startActivityForResult(intent,ImageCode)
       }
  
       override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
           if (requestCode==ImageCode &amp;&amp; data!=null &amp;&amp; resultCode== Activity.RESULT_OK)
           {
               val selectedImage = data.data
               val filepath = arrayOf(MediaStore.Images.Media.DATA)
               val cursor = contentResolver.query(selectedImage,filepath,null,null,null)
               cursor.moveToFirst()
               val Index = cursor.getColumnIndex(filepath[0])
               val Picture = cursor.getString(Index)
               cursor.close()
               imageView.setImageBitmap(BitmapFactory.decodeFile(Picture))
           }
       }
  </code></pre>