Jan Maděra
Jan Maděra

Reputation: 61

Android recognize if resource id is drawable or string

I would like to know if it is possible to recognize, if id is from drawable or strings resource.

For example: If I call R.strings.hello that return int value `2131099681.

Can i recognize that the id is from strings folder?

Upvotes: 1

Views: 603

Answers (2)

Filipe Silva
Filipe Silva

Reputation: 220

I guess you could use (in activity)

getResources().getResourceTypeName(int resid);

As suggested here

Upvotes: 1

Sid
Sid

Reputation: 14896

Give this a try

Resources.getResourceTypeName(int resid)

Docs here

Upvotes: 0

Related Questions