Вопрос

hi developers i am working in a webview in android. i loaded a webpage in WebView. then i click some link that contains in the webpage. Then i click the goback button in my application the onclick of the button contains the below code

webview.canGoBack();
 backbutton.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
                      webview.goBack();
                    }
                 });

but this code works only once. it goes only one clicked link back. i want to goback the every clicked url one by one

Это было полезно?

Решение

Please try it.

backbutton.setOnClickListener(new OnClickListener() {
    @Override
    public void onClick(View v) {
        if (webView.canGoBack()) {
            webView.goBack();
        }
    }
});

Другие советы

You can initiate another loading if you override onPageFinished method of WebViewClient or if you modify shouldOverrideUrlLoading.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top