Elliptica
Elliptica

Reputation: 4322

How to Find All Resource IDs in Android

I know how to find a resource given a certain id (e.g. getResources().getString(R.string.myString), but if I want to get a list of all the id names, how do I do that?

Upvotes: 2

Views: 2681

Answers (1)

AnthonyK
AnthonyK

Reputation: 473

it is R.resource.class.getFields()

for instance

Field[] fields = R.id.class.getFields();
for(int z = 0; z < fields.length; z++){
    someArray[z] = fields[z].getInt();
}

Upvotes: 4

Related Questions