本文整理汇总了Java中android.webkit.WebBackForwardList.getSize方法的典型用法代码示例。如果您正苦于以下问题:Java WebBackForwardList.getSize方法的具体用法?Java WebBackForwardList.getSize怎么用?Java WebBackForwardList.getSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.webkit.WebBackForwardList
的用法示例。
在下文中一共展示了WebBackForwardList.getSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPageFinished
import android.webkit.WebBackForwardList; //导入方法依赖的package包/类
public void onPageFinished(WebView view) {
if (!mIsOnReceivedTitle && mWebChromeClient != null) {
WebBackForwardList list = null;
try {
list = view.copyBackForwardList();
} catch (NullPointerException e) {
if (LogUtils.isDebug()) {
e.printStackTrace();
}
}
if (list != null
&& list.getSize() > 0
&& list.getCurrentIndex() >= 0
&& list.getItemAtIndex(list.getCurrentIndex()) != null) {
String previousTitle = list.getItemAtIndex(list.getCurrentIndex()).getTitle();
mWebChromeClient.onReceivedTitle(view, previousTitle);
}
}
}
示例2: printBackForwardList
import android.webkit.WebBackForwardList; //导入方法依赖的package包/类
public void printBackForwardList() {
WebBackForwardList currentList = this.copyBackForwardList();
int currentSize = currentList.getSize();
for(int i = 0; i < currentSize; ++i)
{
WebHistoryItem item = currentList.getItemAtIndex(i);
String url = item.getUrl();
LOG.d(TAG, "The URL at index: " + Integer.toString(i) + " is " + url );
}
}
示例3: navigateInHistoryIfPossible
import android.webkit.WebBackForwardList; //导入方法依赖的package包/类
public void navigateInHistoryIfPossible(String newUrl){
if(webview!=null){
WebBackForwardList history = webview.copyBackForwardList();
for(int i=0;i<history.getSize();i++){
if(newUrl.equals(history.getItemAtIndex(i).getOriginalUrl()) || newUrl.equals(history.getItemAtIndex(i).getUrl())){
Log.d("WebView", "Found "+newUrl + " at "+i+", steps: "+(i-history.getCurrentIndex()));
webview.goBackOrForward(i-history.getCurrentIndex());
return;
}
}
webview.loadUrl(newUrl);
}
}
示例4: printBackForwardList
import android.webkit.WebBackForwardList; //导入方法依赖的package包/类
public void printBackForwardList()
{
WebBackForwardList localWebBackForwardList = copyBackForwardList();
int i = localWebBackForwardList.getSize();
for (int j = 0; j < i; j++)
{
String str = localWebBackForwardList.getItemAtIndex(j).getUrl();
LOG.d("CordovaWebView", "The URL at index: " + Integer.toString(j) + "is " + str);
}
}