Get Resource ID by Resources String Name Android example

// image from res/drawable
	int resID = getResources().getIdentifier("my_image", 
			"drawable", getPackageName());
// view
	int resID = getResources().getIdentifier("my_resource", 
			"id", getPackageName());
 
// string
	int resID = getResources().getIdentifier("my_string", 
			"string", getPackageName());
This entry was posted in Android Examples Code and tagged , . Bookmark the permalink.


Comments are closed.

19,958 views