When I use this code:
public class VideoSorveglianza extends Activity {
private ProgressDialog mLoading;
...
@Override
public void onCreate(Bundle savedInstanceState) {
...
mLoading = new ProgressDialog(this);
mLoading.setMessage("Loading");
...
}
All works fine. But开发者_运维技巧 If I try this:
mLoading.setMessage(getString(R.string.loading));
with the string declared in res/string.xml, nothing works!
Is this a bug? I use API version 2.2.
EDIT: my string.xml:
<?xml version="1.0" encoding="utf-8"?>
<resources>
...
<string name="loading">Loading...</string>
...
</resources>
Use getResources().getString(R.string.loading)
in mLoading.setMessage()
精彩评论