title: Kotlin Android: Assigning Bitmap to Imageview
body: <p>I am building an app with Kotlin frontend/Python backend. My python script creates a .png file under getFilesDir() directory (/data/user/0/com.example.inprogress/files/mygraph.png). I then want to use kotlin to fetch the .png file and display it on imageview.</p>
  
  <p><a href="https://i.stack.imgur.com/zRjEC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zRjEC.png" alt="enter image description here"></a></p>
  
  <p>My goal is to assign Bitmap value to my imageview id graphId.</p>
  
  <p>I use the code below but I get blank imageview instead of the .png file I want to display.
  Note that I'm not getting any error message. Where am I doing things wrong?</p>
  
  <pre><code>class GraphRes : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_graphres)
  
          var data = intent.extras
          var graph = data!!.get("res").toString()
          // graph is where the .png file is stored
          // graph: /data/user/0/com.example.inprogress/files/mygraph.png
  
  
          var graphId = ImageView(this)
          graphId.setImageBitmap(BitmapFactory.decodeFile(graph))
  
      }
  }
  </code></pre>