Android Resource IDs

后端 未结 3 837
眼角桃花
眼角桃花 2021-02-06 20:35

I\'m retrieving custom Resource IDs from a custom xml view type. I\'m asked to specify a default int value for the retrieval and was wondering what is the range of IDs? Are they

相关标签:
3条回答
  • 2021-02-06 21:15

    According to the documentation, Resources.getIdentifier()

    Returns 0 if no such resource was found. (0 is not a valid resource ID.)

    so you can use 0.

    0 讨论(0)
  • 2021-02-06 21:15

    0 is a null/invalid value for a resource ID.

    0 讨论(0)
  • 2021-02-06 21:24

    According to https://developer.android.com/reference/android/content/res/Resources#ID_NULL, 0 is the same as setting @null in XML, meaning you can use it i.e. when you want to clear the resource.

    It is an invalid resource ID.

    0 讨论(0)
提交回复
热议问题