Code_Life Code_Life - 1 year ago 123
Android Question

How to get Resource Name from Resource id

In my layout I have defined something like this .

android:text="Dnt want this text" />

Assume that some function in activity returns me this id (id of radioButton). Now i want to get this text radio1 from this id.
In short I want to retrieve text radio1 written in

Can somebody tell me how is it possible ?

Answer Source

In your Activity, try the following

getResources().getResourceEntryName(int resid);


getResources().getResourceName(int resid);

You'll prefer the first one I guess.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download