1

I have a simple question. In an Android app with an icon (the launch icon). I want to display this same icon image somewhere inside my app.

How can I so that?

If have tried to access the image and use it with this kind of code:

val apIcnID = resources.getIdentifier("appIcon","id",packageName)
val apIcnCompo = findViewById<ImageView>(apIcnID)
apIcnCompo.setImageResource(R.drawable.ic_launcher_myapp)

But it did not work. I assume what I want to do is basic enough to be easy. But I don't know how to do it at this point. Any tip would be appreciated.

I get this error: (Though this is how my icon is called) Unresolved reference: ic_launcher_myapp

Michel
  • 10,303
  • 17
  • 82
  • 179

0 Answers0