I show a progress dialog with an asynchronous task.
private class RetrieveTask extends AsyncTask<String, Void, String>
{
RetrieveTask t = this;
ProgressDialog d = null;
@Override
protected void onPreExecute()
{
// TODO
//d = ProgressDialog.show(context, "", context.getString(R.string.querying_server), true, true, new DialogInterface.OnCancelListener() {
d = ProgressDialog.show(context, "", "Loading...", true, true, new DialogInterface.OnCancelListener() {
public void onCancel(DialogInterface dialog) {
t.cancel(true);
}
});
// continues....
By this stage context has been set to the root activity.
I’d like to localise the message as indicated in the comment following the “TODO”. To do this I need to get at the strings resource; how do I best do this from here?
I’m missing a
getResources()call, that’s all.context.getResources().getString(R.string.my_string_id);