Suppressing toast from package in Android

余生长醉 提交于 2019-12-06 23:26:29

问题


I'm developing an Android app and I'm trying to show some information with a Toast. I used Toasts 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!