简体   繁体   English

Android解雇系统对话框

[英]Android Dismiss System Dialog

I have a problem circling around the Android Bluetooth Chat example found in the SDK samples. 我在SDK示例中找到的Android蓝牙聊天示例中遇到了问题。 Whenever I connect a to a device and establish a connection, the ConnectedThread is being executed, everything is sweet, the System Dialog pops up askig me to tick in the PIN to pair. 每当我连接到设备并建立连接时,ConnectedThread正在执行,一切都很甜蜜,弹出系统对话框,要求我勾选要配对的PIN。 However, when I click the cancel button on that partiuclar dialog, I want to react on that. 但是,当我单击该partiuclar对话框上的取消按钮时,我想对此做出反应。 Since I rely and also want to rely on a non-custom dialog, I realy wonder how I can fetch the dismiss event on that particular dialog. 由于我依赖并且还想依赖非自定义对话框,我真的很想知道如何在特定对话框中获取dismiss事件。

Regards, Simon 问候,西蒙

Just add this line in your code where you want dialog to dismiss. 只需在您希望对话框关闭的代码中添加此行。

Intent intent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
sendBroadcast(intent);

You can do pairing programmatically to avoid this. 您可以通过编程方式进行配对以避免这种情况。 You may refer Link1 and Link2 您可以参考Link1Link2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM