Reputation: 308
When using toast messages in my app it appears in a wrong shape. The code I am using is:
Toast.makeText(context, context.getResources().getString(R.string.changeLanguageConf), Toast.LENGTH_SHORT).show();
Do you know what could be the root cause? context is an argument passed as getContext() from a different procedure.
Upvotes: 1
Views: 224
Reputation: 308
It was due to the theme used. More specific it was due to:
<item name="android:fitsSystemWindows">true</item>
Thanks for the help
Upvotes: 1
Reputation: 160
Instead of using getContext(), try using getApplicationContext(). I would also try to get the context just before creating and showing the toast, as the following.
Context context = getApplicationContext();
Toast.makeText(context, context.getResources().getString(R.string.changeLanguageConf), Toast.LENGTH_SHORT).show();
Upvotes: 0