在我的PhoneGap Android应用程序是离线,我尝试访问URL的应用程序显示错误(GapViewClient.onReceivedError)消息框和关闭。我如何捕获错误显示,并关闭我的应用程序之前。
When my phonegap android app is offline, and i try to access a url the app displays an error (GapViewClient.onReceivedError) messagebox and closes. How do I catch the error before it is displayed and closes my app.
下面code添加到您的onCreate功能,并创建了资产/ WWW /文件夹正确消息的html文件,
Add the below code to your onCreate function and and create a html file with proper message in the asset/www/folder
webViewClient = new WebViewClient() {
public void onReceivedError( WebView view, int errorCode, String description, String failingUrl)
{
appView.loadUrl("file:///android_asset/www/noConnection.html");
}
};
欲了解更多详情请访问:的http://tech.sarathdr.com/featured/how-to-get-url-not-reached-error-in-anodroid-phonegap