Reputation: 20419
I have the following code:
@Override
protected void onPostExecute(Void arg0) {
...
Toast.makeText(getBaseContext(), getBaseContext().getResources().getString(R.string.toast_sync_completed), Toast.LENGTH_SHORT).show();
}
It fails (FC). If pass "Test string"
instead of getResources().getString(R.string.toast_sync_completed)
, then it works correctly. What am I doing wrong?
Upvotes: 7
Views: 13456
Reputation: 870
try this code
public static void myprofsList(Activity context){
static Context = mConext;
protected void onPostExecute(String result) {
Toast toast=Toast.makeText(mConext,"Succefully Updated Profile Data",Toast.LENGTH_LONG);
}
}
you've to just pass your string file.
Upvotes: -1
Reputation: 29968
Change getBaseContext()... to getApplicationContext().....
Toast.makeText(getApplicationContext(), getApplicationContext().getResources().getString(R.string.toast_sync_completed), Toast.LENGTH_SHORT).show();
Upvotes: 11