android.webkit.WebView.getUrl()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(273)

本文整理了Java中android.webkit.WebView.getUrl()方法的一些代码示例,展示了WebView.getUrl()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebView.getUrl()方法的具体详情如下:
包路径:android.webkit.WebView
类名称:WebView
方法名:getUrl

WebView.getUrl介绍

暂无

代码示例

代码示例来源:origin: RobotiumTech/robotium

public void run() {
    webUrl = webView.getUrl();
  }
});

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

@Override
  public void onRefresh() {
    //重新刷新页面
    webView.loadUrl(webView.getUrl());
  }
});

代码示例来源:origin: commonsguy/cw-omnibus

String getUrl() {
 return(getWebView().getUrl());
}

代码示例来源:origin: JZ-Darkal/AndroidHttpCapture

public void reload(){
  if(webView!=null && webView.getUrl()!=null) {
    webView.reload();
  }
}

代码示例来源: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: cSploit/android

public void onProgressChanged(WebView view, int progress) {
  if ((mWebView != null) && (mURLet != null) && (progress == 0)); {
   getSupportActionBar().setSubtitle(mWebView.getUrl());
   mURLet.setText(mWebView.getUrl());
  }
  if (mProgressBar != null) {
   mProgressBar.setVisibility(View.VISIBLE);
   // Normalize our progress along the progress bar's scale
   mProgressBar.setProgress(progress);
   if (progress == 100) {
    mProgressBar.setVisibility(View.GONE);
   }
  }
 }
});

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void onSaveInstanceState(Bundle outState) {
 super.onSaveInstanceState(outState);
 if (url == null) {
  outState.putString(STATE_URL, getWebView().getUrl());
 }
 else {
  outState.putString(STATE_URL, url);
 }
}

代码示例来源:origin: TommyLemon/APIJSON

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
  super.onPageStarted(view, url, favicon);
  tvBaseTitle.setText(StringUtil.getTrimedString(wvWebView.getUrl()));
  pbWebView.setVisibility(View.VISIBLE);
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
  super.onPageStarted(view, url, favicon);
  tvBaseTitle.setText(StringUtil.getTrimedString(wvWebView.getUrl()));
  pbWebView.setVisibility(View.VISIBLE);
}

代码示例来源:origin: Justson/AgentWeb

@Override
public void onProgressChanged(WebView view, int newProgress) {
  if (this.mAgentWebView.mJsCallJavas != null) {
    this.mAgentWebView.injectJavaScript();
    if (LogUtils.isDebug()) {
      Log.d(TAG, "injectJavaScript, onProgressChanged.newProgress = " + newProgress + ", url = " + view.getUrl());
    }
  }
  if (this.mAgentWebView.mInjectJavaScripts != null) {
    this.mAgentWebView.injectExtraJavaScript();
  }
  super.onProgressChanged(view, newProgress);
}

代码示例来源:origin: square/assertj-android

public WebViewAssert hasUrl(String url) {
 isNotNull();
 String actualUrl = actual.getUrl();
 assertThat(actualUrl) //
   .overridingErrorMessage("Expected URL <%s> but was <%s>.", url, actualUrl) //
   .isEqualTo(url);
 return this;
}

代码示例来源:origin: Justson/AgentWeb

@Override
public void onPageFinished(WebView view, String url) {
  super.onPageFinished(view, url);
  mAgentWebView.mFixedOnReceivedTitle.onPageFinished(view);
  if (LogUtils.isDebug()) {
    Log.d(TAG, "onPageFinished.url = " + view.getUrl());
  }
}

代码示例来源:origin: TommyLemon/APIJSON

@Override
public void onClick(View v) {
  if (v.getId() == R.id.tvBaseTitle) {
    toActivity(EditTextInfoWindow.createIntent(context
        , EditTextInfoWindow.TYPE_WEBSITE
        , StringUtil.getTrimedString(tvBaseTitle)
        , wvWebView.getUrl()),
        REQUEST_TO_EDIT_TEXT_WINDOW, false);
  }
}

代码示例来源:origin: TommyLemon/Android-ZBLibrary

@Override
public void onClick(View v) {
  if (v.getId() == R.id.tvBaseTitle) {
    toActivity(EditTextInfoWindow.createIntent(context
        , EditTextInfoWindow.TYPE_WEBSITE
        , StringUtil.getTrimedString(tvBaseTitle)
        , wvWebView.getUrl()),
        REQUEST_TO_EDIT_TEXT_WINDOW, false);
  }
}

代码示例来源:origin: Justson/AgentWeb

private boolean deepLink(String url) {
  switch (mUrlHandleWays) {
    // 直接打开其他App
    case DERECT_OPEN_OTHER_PAGE:
      lookup(url);
      return true;
    // 咨询用户是否打开其他App
    case ASK_USER_OPEN_OTHER_PAGE:
      if (mAgentWebUIController.get() != null) {
        mAgentWebUIController.get()
            .onOpenPagePrompt(this.mWebView,
                mWebView.getUrl(),
                getCallback(url));
      }
      return true;
    // 默认不打开
    default:
      return false;
  }
}

代码示例来源:origin: Justson/AgentWeb

@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
  super.onPageStarted(view, url, favicon);
  if (mAgentWebView.mJsCallJavas != null) {
    mAgentWebView.injectJavaScript();
    if (LogUtils.isDebug()) {
      Log.d(TAG, "injectJavaScript, onPageStarted.url = " + view.getUrl());
    }
  }
  if (mAgentWebView.mInjectJavaScripts != null) {
    mAgentWebView.injectExtraJavaScript();
  }
  mAgentWebView.mFixedOnReceivedTitle.onPageStarted();
  mAgentWebView.fixedAccessibilityInjectorExceptionForOnPageFinished(url);
}

代码示例来源:origin: robolectric/robolectric

@Test
public void getUrl() throws Exception {
 webView.clearHistory();
 assertThat(webView.getUrl()).isNull();
 webView.loadUrl("fake.url", null);
 assertThat(webView.getUrl()).isEqualTo("fake.url");
}

代码示例来源:origin: wangdan/AisenWeiBo

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
  menu.removeGroup(R.id.browser);
  getMenuInflater().inflate(R.menu.menu_browser, menu);
  String shareContent = String.format("%s %s ", mWebView.getTitle() + "", mWebView.getUrl() + "");
  Intent shareIntent = Utils.getShareIntent(shareContent, "", null);
  MenuItem shareItem = menu.findItem(R.id.share);
  ShareActionProvider shareProvider = (ShareActionProvider) MenuItemCompat.getActionProvider(shareItem);
  shareProvider.setShareHistoryFileName("channe_share.xml");
  shareProvider.setShareIntent(shareIntent);
  return super.onPrepareOptionsMenu(menu);
}

代码示例来源:origin: HotBitmapGG/bilibili-android-client

@Override
public void onBackPressed() {
  if (mWebView.canGoBack() && mWebView.copyBackForwardList().getSize() > 0
      && !mWebView.getUrl().equals(mWebView.copyBackForwardList()
      .getItemAtIndex(0).getOriginalUrl())) {
    mWebView.goBack();
  } else {
    finish();
  }
}

代码示例来源: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");
}

相关文章

WebView类方法