本文整理了Java中android.webkit.WebView.saveState()
方法的一些代码示例,展示了WebView.saveState()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.saveState()
方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:saveState
暂无
代码示例来源:origin: rmtheis/android-ocr
@Override
protected void onSaveInstanceState(Bundle state) {
String url = webView.getUrl();
if (url != null && url.length() > 0) {
webView.saveState(state);
state.putBoolean(WEBVIEW_STATE_PRESENT, true);
}
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldReturnHistoryFromSaveState() {
webView.loadUrl("foo1.bar");
webView.loadUrl("foo2.bar");
Bundle outState = new Bundle();
WebBackForwardList historyList = webView.saveState(outState);
assertThat(historyList.getSize()).isEqualTo(2);
assertThat(historyList.getCurrentItem().getUrl()).isEqualTo("foo2.bar");
}
代码示例来源: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 onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: animalize/QuanTangshi
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
webView.saveState(outState);
}
代码示例来源:origin: mgks/Android-SmartWebView
@Override
protected void onSaveInstanceState(Bundle outState ){
super.onSaveInstanceState(outState);
asw_view.saveState(outState);
}
代码示例来源:origin: kaku2015/WeatherAlarmClock
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: mengdd/HelloActivityAndFragment
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
Log.e(TAG, "onSaveInstanceState(): " + outState);
//Fragment被销毁的情况, 依靠outState保存WebView状态
if (webView != null) {
webView.saveState(outState);
}
}
代码示例来源:origin: myxh/CoolShopping
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: alienjun/AJWaveRefreshForAndroid
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: Wan7451/Wan_RecycleViewAdapter
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: huangfangyi/FanXin
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: evernote/evernote-sdk-android
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
mWebView.saveState(outState);
}
代码示例来源:origin: marzika/Snapprefs
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
browser.saveState(outState);
}
代码示例来源:origin: com.albedinsky.android/fragments
/**
*/
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Save web view state.
if (mWebView != null) {
mWebView.saveState(outState);
}
outState.putInt(BUNDLE_PRIVATE_FLAGS, mPrivateFlags);
outState.putString(BUNDLE_WEB_VIEW_CONTENT, mContent);
}
代码示例来源:origin: com.albedinsky.android.support/support-fragments
/**
*/
@Override
public void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
// Save web view state.
if (mWebView != null) {
mWebView.saveState(outState);
}
outState.putInt(BUNDLE_PRIVATE_FLAGS, mPrivateFlags);
outState.putString(BUNDLE_WEB_VIEW_CONTENT, mContent);
}
代码示例来源:origin: Uphie/ONE-Unofficial
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: shanyao0/SimpleApp
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: gdpancheng/LoonAndroid3
@Override
protected void onPtrSaveInstanceState(Bundle saveState) {
super.onPtrSaveInstanceState(saveState);
mRefreshableView.saveState(saveState);
}
代码示例来源:origin: amahi/android
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
getWebView().saveState(outState);
}
内容来源于网络,如有侵权,请联系作者删除!