Example usage for android.webkit WebHistoryItem getFavicon

List of usage examples for android.webkit WebHistoryItem getFavicon

Introduction

In this page you can find the example usage for android.webkit WebHistoryItem getFavicon.

Prototype

@Nullable
public abstract Bitmap getFavicon();

Source Link

Document

Return the favicon of this history item or null if no favicon was found.

Usage

From source file:dev.memento.MementoBrowser.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebview.canGoBack()) {

        // Get the previous URL to update our internal copy 

        WebBackForwardList list = mWebview.copyBackForwardList();
        int curr = list.getCurrentIndex();
        WebHistoryItem item = list.getItemAtIndex(curr - 1);
        Bitmap favicon = item.getFavicon();

        if (favicon == null)
            Log.d(LOG_TAG, "No favicon in WebHistoryItem - null");
        else/* w  w  w .jav  a 2s . co m*/
            Log.d(LOG_TAG, "WebHistoryItem favicon W = " + favicon.getWidth());

        mOriginalUrl = item.getUrl();
        Log.d(LOG_TAG, "GO BACK TO " + mOriginalUrl);

        mWebview.goBack();
        return true;
    }
    return super.onKeyDown(keyCode, event);
}