Issue
I have a string resource defined in strings.xml as follows:
<string name="web_app_url">http://BlueBadgeParking.com</string>
In one of my activities I attempt to get the string and assign it to a variable (I've tried this in the main activity class and in the onCreate class but the same thing happens):
String blueBadgeParkingURL = getResources().getString(R.string.web_app_url);
I then attempt to use this variable to load the URL in a WebView:
mWebView.loadUrl(blueBadgeParkingURL);
Manually entering the URL in the loadUrl
call works fine, but when I try to use the variable set from the string resource the app crashes with "Unfortnately, {my_app_name} has stopped".
What am I doing wrong?
Solution
Do it like this:
mWebView.loadUrl(getString(R.string.web_app_url));
Answered By - meda
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.