问题
I'm developing an Android app and I'm trying to show some information with a Toast
.
I used Toast
s in other projects and everything works, but in this app, when the Toast
should appear, it doesn't do it and Logcat shows the next message:
Suppressing toast from package com.xxxxxxx by user request.
I'm creating the toast with the next code:
Context context = xxxxxxx.this;
CharSequence text = "Hello toast!";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
I tried to set the context with getApplicationContext()
and getBaseContext()
too, but doesn't work.
Anyone knows how to solve this problem?
Thank you very much.
回答1:
Go to the App-Info Screen of your application ( long click on the app and drag it to the top in Android 4.0) and make sure the "Show notification" checkbox is selected. Otherwise your Toasts will be suppressed.
来源:https://stackoverflow.com/questions/11568243/suppressing-toast-from-package-in-android