Issue
I am trying to get string resource value from IntentService as follows :
String errorTitle = getResources().getString(R.string.no_Internet_connection_error_title);
But it shows an error no_Internet_connection_error_title cannot be resolved or is not a field
.
When I type R.string.
, eclipse shows a list of android defined strings, not defined by me.
I use string resource in activity, but not able to use in IntentService.
Solution
I thought one of the guys who commented will post an answer. But as they have not I am posting it.
The solution was either to import R.java
file using package name :
import com.android.myApp.R;
Or to use whole package name to get string :
getResources().getString(com.android.myApp.R.string.no_Internet_connection_error_title);
Answered By - Geek
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.