I need to pass a resource ID to a method in one of my classes. It needs to use both the id that the reference points to and also it needs the string. How should I best achie
In MonoDroid / Xamarin.Android you can do:
var resourceId = Resources.GetIdentifier("icon", "drawable", PackageName);
But since GetIdentifier it's not recommended in Android - you can use Reflection like this:
var resourceId = (int)typeof(Resource.Drawable).GetField("icon").GetValue(null);
where I suggest to put a try/catch or verify the strings you are passing.