当一个应用程序需要网络连接和连接失败,我得到一个消息对话框
Whenever a application needs internet and connection fails, I get a message dialog
连接失败
此应用程序需要访问网络。启用移动网络或Wi-Fi下载数据。
Connection failed
This application requires network access. Enable mobile network or Wi-Fi to download data.
和两个按钮,设置,取消。
and two buttons, Settings, Cancel.
我如何检测在没有互联网连接? 我如何在我的应用程序弹出一个对话框相同?
How do I detect there is no internet connection? How do I popup a same dialog in my application?
推荐答案
在这里你可以找到关于如何建立对话参考
Here you can find a reference on how to build dialogs
http://developer.android.com/guide/topics/ui/ dialogs.html
下面是一个code片段,可以帮助你检测网络连接:
Here is a code snippet that should help you detecting internet access:
http://www.androidsnippets.org/snippets/131/
BTW:是不是你问的这个问题已经在2009年15十一月? http://groups.google.com/group/android-beginners/browse_thread/thread/715cedfc5fd6f020?utoken=QyP-dzQAAACEe9Lph6eUOAakqA3-BnR-KvPfK0ltyCETgVsCM3D7GeEWTAM9S5G8WBs1q2tBppm1FwwMIvCGKnxkm-CrwSdp
btw: wasn't it you that asked this question already on 15. Nov. 2009? http://groups.google.com/group/android-beginners/browse_thread/thread/715cedfc5fd6f020?utoken=QyP-dzQAAACEe9Lph6eUOAakqA3-BnR-KvPfK0ltyCETgVsCM3D7GeEWTAM9S5G8WBs1q2tBppm1FwwMIvCGKnxkm-CrwSdp
相关推荐
最新文章