How to bookmark a webpage in an Android applicatio

2019-03-30 16:57发布

问题:

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.

回答1:

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?

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

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 for a site: http://developer.android.com/reference/android/webkit/WebView.html#getFavicon()

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

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.

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()