Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Getting int instead of value of string resource

$
0
0

This should be a simple one. I don't get what's going on here.

I have a public "Utility" class that I use to group some routine functions in my app so they aren't repeated in full every place I need to use them.

For example. My app's webserver information could change over time, so instead of hardcoding it every place I need to use it, I have placed the information in my resources file.

<?xml version="1.0" encoding="utf-8"?>
<resources> 
    <string name="app_name">ListViewTest</string>
    <string name="prod_prompt">Select Product</string>
    <string name="title_state">Select State</string>
    <string name="serveraddress">mywebserver.com</string>
    <string name="appdir">applicationdirectory</string>
</resources>

Then what I want to do is put the string together with this...

public class Utilities
    {
        public static string ServerInfo() {
            string Server = Resource.String.serveraddress.ToString();
            string AppDir = Resource.String.appdir.ToString();
            string BaseURL = "http://" + Server + "/" + AppDir + "/";
            return BaseURL;
        }
    }

It compiles, but when displayed in my app, it shows the integer values from Resource.designer.cs instead of the string values.


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>