Convert String containing an ID into an Integer-ID

后端 未结 6 1569
别那么骄傲
别那么骄傲 2020-12-10 03:57

I have a short question:

How is it possible to convert a String, containing the Id of a Drawable, which is

String idString = \"R.drawable.bubblegum\"         


        
6条回答
  •  抹茶落季
    2020-12-10 04:20

    if your idString is constant, i.e. it's doesn't change during runtime, follow DeeV's answer. If it changes, you can take a look at getIdentifier method.

提交回复
热议问题