How To Create A Web Bookmark With Thumbnails Android Widgets?
Solution 1:
This is for ICS+ only :
Browser API is being revamped along the lines of Contacts API, now bookmarks are linked to Accounts and also have a folder structure.As far as I know, new Internals have not been exposed via public API calls, and all implementations are likely to be changed in future, and your App might stop working then, if you use internal API. Still, its worth while to know internal workings of android browser provider:
In BrowserProvider2
. Now, thumbnails are in a different table, and have their own URI. But internally, they are placing data in images table, this also has a URI.
Have a look at structure of new Bookmarks table and Thumbnails table and Images table. Then , see how bookmarks are being inserted :
Also, BrowserContract
has these columns defined as ImageColumns
these store, thumbnails, favicon, and touch icons etc.
Finally, query()
has matches for IMAGES
(no id, url is primary key) and THUMBNAILS
(with id).
So, from here you can get whatever images you need using new CONTENT_URI
of BrowserContract
, append it with URI's of Images,Thumbnails etc and run your queries/inserts .
Solution 2:
I think for thumbnails you put your link on webView and save your webView under bitmap. Then you save bitmap on SD card and your have your thumbnail.
You can get bookmarks like this :
Cursor mCur = ActivityChooseBookmark.this.getContentResolver().query(android.provider.Browser.BOOKMARKS_URI,
projection, Browser.BookmarkColumns.BOOKMARK, null, null);
Use this to get your bitmap from webView :
public static Bitmap getBitmapFromView(View view) {
Bitmap returnedBitmap = Bitmap.createBitmap(view.getWidth(), view.getHeight(),Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(returnedBitmap);
Drawable bgDrawable = view.getBackground();
if (bgDrawable!=null)
bgDrawable.draw(canvas);
else
canvas.drawColor(Color.TRANSPARENT);
view.draw(canvas);
return returnedBitmap;
}
Now just save it on SD and it's done
Post a Comment for "How To Create A Web Bookmark With Thumbnails Android Widgets?"