Display the Android WebView's favicon

末鹿安然 提交于 2019-12-03 04:08:30

For the WebView icon methods and listeners to work, you need to first open the WebIconDatabase manually. You would typically do this in the onCreate() method of your Activity.

Try adding the following line to onCreate():

WebIconDatabase.getInstance().open(getDir("icons", MODE_PRIVATE).getPath());

Once you've done this, you should start getting onReceivedIcon() callbacks for any WebView in this Activity, and the getFavicon() method should also start returning a valid object rather than null whenever icons are available.

I think to remember that there is a method getFavicon() available for the WebView object. here is my stupid question did you try that?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!