Using Android getIdentifier()

后端 未结 3 1836
萌比男神i
萌比男神i 2020-11-27 04:42

I\'ve tried this:

r = Resources.getSystem().getIdentifier(\"ball_red\",\"drawable\",\"com.Juggle2\");
Log.i(\"FindBall\",\"R = \"+r);

And t

3条回答
  •  忘掉有多难
    2020-11-27 04:59

    Though the answer from Festus Tamakloe is correct I found a quirk in this function.

    If you are declaring a string-array in a xml file it must be accessed by calling the base resource type array, using string-array results in anid 0 return.

提交回复
热议问题