且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Android 应用程序中为网页添加书签?

更新时间:2023-11-24 17:53:40

也许您可以将 url 与 favicon 一起保存在数据库中,或者尝试从站点获取屏幕截图以用作图标?

Perhaps you can just save the url in a database together with the favicon or try to get a screenshot from the site to use as icon?

您可以毫无问题地将 Webview 转换为 Drawable/Bitmap.

You could probably convert the Webview to a Drawable/Bitmap without too much problems.

这里有两个适用于 Android 的数据库/sql 教程:

Here's two database/sql tutorials for Android:

http://www.screaming-penguin.com/node/7742

http://developer.android.com/resources/tutorials/notepad/index.html

网站的 Favicon:http://developer.android.com/reference/android/webkit/WebView.html#getFavicon()

Favicon for a site: http://developer.android.com/reference/android/webkit/WebView.html#getFavicon()

从评论这是来自 Android 团队的官方数据库教程.http://developer.android.com/resources/tutorials/notepad/index.html

EDIT from comment: Here is an official database tutorial from the Android team. http://developer.android.com/resources/tutorials/notepad/index.html

它创建了一个记事本应用程序,该应用程序使用数据库来保存笔记.您可以将它用作新闻应用程序的基础,而不是将注释存储在数据库中,您可以存储 URL、标题和有关书签的任何其他信息.

It creates a notepad app what uses a database to save notes. You can use it as a base for your news app and instead of storing notes in the database you can store URL, Title and any other information about the bookmark.

将信息保存到数据库后,您可以使用 Webview 中的 getFavicon() 方法(如果您使用的是 webvire)来获取书签的图标(如果您愿意的话).http://developer.android.com/reference/android/webkit/WebView.html#getFavicon()

After you have saved the information to the database you can use the getFavicon() method in the Webview (if a webvire is what you are using) to get an icon for the bookmark if you wish one. http://developer.android.com/reference/android/webkit/WebView.html#getFavicon()