Converting R.java variable to URI
Is this possible converting R.java variable to URI reference? What can be URI?
开发者_运维百科PS: So silly question I know. But thanks for your kind helps..
Do you mean that you're storing URIs as string values in an xml file, and need to convert those into java.net.URI
objects?
If so...
In an xml file called uris.xml
<resources>
<string name="stackoverflow">http://www.stackoverflow.com</string>
</resources>
And then in your Java code you can use
import java.net.URI;
URI stackoverflowUri = new URI(getResources().getString(R.uri.stackoverflow));
(you'll need to add code to catch any URISyntaxException
thrown by the new URI
call)
精彩评论