0

I am working on google instant app development. In my app there are image buttons and set to default grey scaled images in each button. When user open the app, user input some numeric value. Base on that, one of button's image is replaced with color one.

//after user's input, we know userChoiceInput and which button we need to touch
var userButtonId: String = "btn" + userChoiceInput

val imgBtnId: Int = resources.getIdentifier(userButtonId, "id", packageName)

I need to get the imgBtnId.

If I run it in installed app version, I get what I want.

However, if I run in instant app version, I get 0...which is not intended.

Additional information I can say is that I got following exception.

kotlin.TypeCastException: null cannot be cast to non-null type android.widget.ImageButton

Is this known bug?

Thanks.

Jeremy
  • 1
  • 85
  • 340
  • 366
HanJo Jang
  • 23
  • 1
  • 4
  • Can you please post the full exception stacktrace? Log `userButtonId ` and `packageName` so you can see their values. – m0skit0 Jun 22 '18 at 20:45
  • both userButtonId and package name are in right format. I use Log.d for checking. it runs fine in installed version. just not working in instant version – HanJo Jang Jun 22 '18 at 23:52

0 Answers0