0
webview를 사용하는 응용 프로그램에 대한 사용자 정의 오류 메시지를 작성하려고합니다. 지금까지 아주 최소한의 문제가있는 코드 아래에서 사용하고 있습니다 ... 클릭하면 webview에서 링크를 클릭하면 클릭 한 링크를 처리하는 대신 같은 페이지가 다시로드됩니다. 이 다운 로더 옵션을 같은 응용 프로그램을 사용하여 다운로드하거나 열립니다 중 하나 있도록 웹보기에 내 링크는 다운로드 링크입니다webview에서 사용자 정의 오류 메시지를 표시하는 방법
protected void fetch_web(){
final WebView web;
web = (WebView) findViewById(R.id.voice_mail_view_port);
NoNetwork = (Button) findViewById(R.id.btn_no_internet);
NoNetwork.setVisibility(View.GONE);
String mdb = "http://192.168.23.1/default.php";
getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);
final Activity MyActivity = this;
web.setWebChromeClient(new WebChromeClient() {
public void onProgressChanged(WebView view, int progress)
{
MyActivity.setTitle("Fetching feeds...");
MyActivity.setProgress(progress * 100);
loader();
if(progress == 100) {
MyActivity.setTitle(R.string.app_name);
deLoader();;
}
}
});
web.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String
failingUrl) {
deLoader();
alert("No Internet Connection","Let's get connected to see feeds");
web.setVisibility(View.GONE);
NoNetwork.setVisibility(View.VISIBLE);
}
});
web.getSettings().setJavaScriptEnabled(true);
web.loadUrl((mdb));
}
protected void loader(){
loading = (ProgressBar) findViewById(R.id.loader);
loading.setVisibility(View.VISIBLE);
}
protected void deLoader(){
loading = (ProgressBar) findViewById(R.id.loader);
loading.setVisibility(View.INVISIBLE);
}
http://192.168.23.1/download.php?id=1 내 오류가샘플 다운로드 링크가
가 가누군가가 나를 도울 수있는, 내가 생각
web.setWebViewClient(new WebViewClient() {
public void onReceivedError(WebView view, int errorCode, String description, String
failingUrl) {
deLoader();
alert("No Internet Connection","Let's get connected to see feeds");
web.setVisibility(View.GONE);
NoNetwork.setVisibility(View.VISIBLE);
}
});
완벽한 작업. 감사 – LazyLoading