-5

I try to load a url from string line to pass a url for my RSS feed.

current code is:

String RSSFEEDURL = "http://feed.com/feed/";

I add a string in the string file:

<string name="RSSFEEDURL">http://download.yallagroup.net/en/feed</string>

And then I try to call it from the java using this code:

String RSSFEEDURL = getString(R.string.RSSFEEDURL);

But it does not load. Any help with that?

krsteeve
  • 1,794
  • 4
  • 19
  • 29
Mohamed
  • 25
  • 1
  • 4

1 Answers1

0

You've mentioned that I add a string in the string file. I am assuming that you are talking about string.xml. I think just searching for "How to obtain string from string.xml file" will give you lots of answers. One of the reference is see Android: How do I get string from resources using its name? . You need to use getResources() for getting resources first.

String RSSFEEDUR = getResources().getString(R.string.RSSFEEDURL);

I think @shkschneider is right. It might be good for you to start with some tutorials first.

Community
  • 1
  • 1
Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124