Reputation: 2400
I stored an url on the strings.xml file to show it in my app, it is something like this:
<string name="url_stat">https://my.websyte.net/url_stramin/api/v1/</string>
When I want to use it in java I call it this way:
textView.setText(R.string.url_stat+"key/");
Log.i("KEY",R.string.url_stat+"key/");
But what I get is this text:
2131623976key/
for some reason this string turns into a number, why? how to avoid it?
Upvotes: 0
Views: 54
Reputation: 36237
That number is the numerical identifier (the resource value) you should do the following
textview.setText(getString(R.string.url_stat) + "key/");
Upvotes: 5
Reputation: 171
Have you tried to add the CDATA Tag in your xml? Something like this:
<string name="url_stat"><![CDATA[https://my.websyte.net/url_stramin/api/v1/]]></string>
I'm not sure if it works, I haven't tested
Upvotes: 0