xamarin.android - (Android Xamarin) Get Resource string value instead of int -
im starting create simple android app use of xamarin using vs2012. know there type of resource strings. in resource folder, have xml file this:
<?xml version="1.0" encoding="utf-8"?> <resources> <string name="recordstable">records</string> <string name="projecttable">projects</string> <string name="activitiestable">activities</string> </resources>
in code, want use values of resources like:
string recordtable = resource.string.recordstable; //error, data type incompatibility
i know resource.string.<key>
returns integer cant use code above. hoping recordtable
variable have value of records
.
is there way can use value of resource string code's string variables?
try using resources.getstring getting string string resources
context context = this; // resources object our context android.content.res.resources res = context.resources; // string resource, above. string recordtable = res.getstring(resource.string.recordstable);
Comments
Post a Comment