I cant see the toast message in android 4.1 mobile. Upto yesterday I was able to see the toast message. From today only I can not see the message. Please help me.
I had the same problem. When I invoked the code on UI thread the issue resolved for me
public void showToastMessage(final String msg) {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(BaseActivity.this, msg, Toast.LENGTH_LONG).show();
}
});
}
Toast was not showing with me in Android 4.1 because Show Notifications was checked off in my app's settings. I just went to Settings->Manage Applications->[My App] and toggled on Show Notifications and Toasts started to appear.
just post the google code link here.
Since Jelly Bean, users can disable notifications for a given app via "app details" settings.
A very bad and unwanted side effect is that once notifs are disabled, Toast messages are also disabled, even when the user is running the app!
You encourage to use Toast in your design guidelines, but who will want to use it if the users have the possibility to remove them, especially if the toasted message is an important feedback to display to the user...
I understand at least that Toasts could be disabled when the app is in background, but not if it is the foreground Activity.
Change to this and check again.
if(first_name.length() == 0)
{
Toast.makeText(NameOfYourActivity.this, "Please fill Name", Toast.LENGTH_SHORT).show();
Utilities.writeIntoLog("Please fill Name");
}
Toast is working fine in all the version of Android. There can be couple of issues in your code like
Edit In your custom toast don't set the parent in your layout inflater for example use like below
View layout = inflater.inflate(R.layout.toast_layout,null);