本文整理了Java中android.webkit.WebView.restoreState()
方法的一些代码示例,展示了WebView.restoreState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.restoreState()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:restoreState
暂无
代码示例来源:origin: stackoverflow.com
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.blah);
WebView webview = (WebView)findViewById(R.id.webview);
if (savedInstanceState != null)
webview.restoreState(savedInstanceState);
else
webview.loadUrl(URLData)
}
代码示例来源:origin: rmtheis/android-ocr
@Override
protected void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.help);
webView = (WebView)findViewById(R.id.help_contents);
webView.setWebViewClient(new HelpClient(this));
Intent intent = getIntent();
String page = intent.getStringExtra(REQUESTED_PAGE_KEY);
// Show an OK button.
View doneButton = findViewById(R.id.done_button);
doneButton.setOnClickListener(doneListener);
if (page.equals(DEFAULT_PAGE)) {
doneButton.setVisibility(View.VISIBLE);
} else {
doneButton.setVisibility(View.GONE);
}
// Froyo has a bug with calling onCreate() twice in a row, which causes the What's New page
// that's auto-loaded on first run to appear blank. As a workaround we only call restoreState()
// if a valid URL was loaded at the time the previous activity was torn down.
if (icicle != null && icicle.getBoolean(WEBVIEW_STATE_PRESENT, false)) {
webView.restoreState(icicle);
} else if (intent != null && page != null && page.length() > 0) {
webView.loadUrl(BASE_URL + page);
} else {
webView.loadUrl(BASE_URL + DEFAULT_PAGE);
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldReturnNullFromRestoreStateIfNoHistoryAvailable() {
Bundle inState = new Bundle();
WebBackForwardList historyList = webView.restoreState(inState);
assertThat(historyList).isNull();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldSaveAndRestoreHistoryList() {
webView.loadUrl("foo1.bar");
webView.loadUrl("foo2.bar");
Bundle outState = new Bundle();
webView.saveState(outState);
WebView newWebView = new WebView(ApplicationProvider.getApplicationContext());
WebBackForwardList historyList = newWebView.restoreState(outState);
assertThat(newWebView.canGoBack()).isTrue();
assertThat(newWebView.getUrl()).isEqualTo("foo2.bar");
assertThat(historyList.getSize()).isEqualTo(2);
assertThat(historyList.getCurrentItem().getUrl()).isEqualTo("foo2.bar");
}
代码示例来源:origin: tianshaojie/AndroidFine
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: marzika/Snapprefs
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
browser.restoreState(savedInstanceState);
}
}
代码示例来源:origin: stackoverflow.com
super.onActivityCreated(savedInstanceState);
// restore webview state
WebView webView = (WebView) mRootView.findViewById(R.id.fragment_main_webview);
if(savedInstanceState!=null)
{
webView.restoreState(savedInstanceState);
}
// setup webview
renderView();
webView.getSettings().setUserAgentString("my-app");
代码示例来源:origin: myxh/CoolShopping
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: huangfangyi/FanXin
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: open-android/PullToRefresh
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: Uphie/ONE-Unofficial
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: shanyao0/SimpleApp
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: kaku2015/WeatherAlarmClock
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: animalize/QuanTangshi
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
webView.restoreState(savedInstanceState);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: mgks/Android-SmartWebView
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState){
super.onRestoreInstanceState(savedInstanceState);
asw_view.restoreState(savedInstanceState);
}
}
代码示例来源:origin: alienjun/AJWaveRefreshForAndroid
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: AndroidHensen/YaNi
@Override
protected void onPtrRestoreInstanceState(Bundle savedInstanceState) {
super.onPtrRestoreInstanceState(savedInstanceState);
mRefreshableView.restoreState(savedInstanceState);
}
代码示例来源:origin: amahi/android
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
getWebView().restoreState(savedInstanceState);
}
内容来源于网络,如有侵权,请联系作者删除!