0
我正在使用loaddatawithbaseurl加载我从api生成的自定义html到webview。我怎样才能回到先前使用loaddatawithbaseurl加载的上一页? 假设我去: Page1-> Page2-> Page3Android Webview goback与loaddatawithbaseurl
我该如何回到Page2?
我试过wb.goback,但是只是加载一个白页。我有点沉迷于此。有谁知道一个明确的方法来做到这一点?
wb = (ObservableWebView) findViewById(R.id.webView);
wb.getSettings().setJavaScriptEnabled(true);
wb.getSettings().setLoadWithOverviewMode(true);
wb.getSettings().setUseWideViewPort(true);
wb.getSettings().setBuiltInZoomControls(false);
wb.getSettings().setSupportZoom(false);
wb.setBackgroundColor(Color.TRANSPARENT);
wb.setWebViewClient(new MyWebViewClient());
String htmls = "<html><head></head><body>Page 1</body></html>";
wb.loadDataWithBaseURL("file:///android_asset/", htmls, "text/html", "utf-8", "");
htmls = "<html><head></head><body>Page 2</body></html>";
wb.loadDataWithBaseURL("file:///android_asset/", htmls, "text/html", "utf-8", "");
htmls = "<html><head></head><body>Page 3</body></html>";
wb.loadDataWithBaseURL("file:///android_asset/", htmls, "text/html", "utf-8", "");
public void onBackPressed() {
wb.goback;
}