Android添加书签(二)(17)
来源:未知 责任编辑:责任编辑 发表时间:2013-11-26 22:12 点击:次
*
* @param cr
* The ContentResolver to use.
* @param url
* The url of the bookmark to update.
* @param favicon
* The favicon bitmap to write to the db.
*/
/* package */static void updateBookmarkFavicon(ContentResolver cr,
String url, Bitmap favicon) {
if (url == null || favicon == null) {
return;
}
// Strip the query.
int query = url.indexOf('?');
String noQuery = url;
if (query != -1) {
noQuery = url.substring(0, query);
}
url = noQuery + '?';
// Use noQuery to search for the base url (i.e. if the url is
// http://www.yahoo.com/?rs=1, search for http://www.yahoo.com)
// Use url to match the base url with other queries (i.e. if the url is
// http://www.google.com/m, search for
// http://www.google.com/m?some_query)
final String[] selArgs = new String[] { noQuery, url };
final String where = "(" + Browser.BookmarkColumns.URL + " == ? OR "
+ Browser.BookmarkColumns.URL + " GLOB ? || '*') AND "
+ Browser.BookmarkColumns.BOOKMARK + " == 1";
final String[] projection = new String[] { Browser.BookmarkColumns._ID };
final Cursor c = cr.query(Browser.BOOKMARKS_URI, projection, where,
selArgs, null);
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>