Android Resource IDs

According to the documentation, Resources.getIdentifier()

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

UPDATE (after 5+ years thanks to Micer):

  • API 29+: Resources.ID_NULL constant
  • older API: ResourcesCompat.ID_NULL

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 is a null/invalid value for a resource ID.