如何在 Android 应用程序中为网页添加书签? [英] How to bookmark a webpage in an Android application?

查看:33
本文介绍了如何在 Android 应用程序中为网页添加书签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个类似报纸的应用程序.我想知道如何通过单击按钮保存网页并在以后显示它.

I am developing a Newspaper like application. I'm wondering how to save webpages with the click of a button and display it at a later point in time.

我用谷歌搜索这个是徒劳的.如果有人知道如何做到这一点并且可以提供一些有用的链接,将不胜感激.

I googled for this in vain. If anyone knows how to do this and can provide some useful links, it would be greatly appreciated.

推荐答案

也许您可以将 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()

这篇关于如何在 Android 应用程序中为网页添加书签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆