List of usage examples for android.provider Browser HISTORY_PROJECTION_TITLE_INDEX
int HISTORY_PROJECTION_TITLE_INDEX
To view the source code for android.provider Browser HISTORY_PROJECTION_TITLE_INDEX.
Click Source Link
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Utility method to load the list of browser bookmarks. *//* w ww.j a v a2 s . co m*/ private static ArrayList<BookmarkInfo> loadBookmarks(Launcher context) { ArrayList<BookmarkInfo> bookmarks = new ArrayList<BookmarkInfo>(); Cursor cursor = context.managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, null); if (cursor != null) { cursor.moveToFirst(); if (cursor.moveToFirst() && cursor.getCount() > 0) { while (cursor.isAfterLast() == false) { String bookmarkIndex = cursor.getString(Browser.HISTORY_PROJECTION_BOOKMARK_INDEX); if (bookmarkIndex != null && bookmarkIndex.equals("1")) { BookmarkInfo bookmark = new BookmarkInfo(); String title = cursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX); bookmark.setTitle(title); String url = cursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); bookmark.setUrl(url); // for some reason the favicons aren't good looking // images // byte[] data = // cursor.getBlob(Browser.HISTORY_PROJECTION_FAVICON_INDEX); // if (data != null) { // try { // Bitmap bitmap = BitmapFactory.decodeByteArray(data, // 0, data.length); // bookmark.setDrawable(new FastBitmapDrawable(bitmap)); // } catch (Exception e) { // Log.e(LOG_TAG, "bookmark icon", e); // } // } bookmarks.add(bookmark); } cursor.moveToNext(); } } } return bookmarks; }
From source file:com.entertailion.android.launcher.Dialogs.java
/** * Utility method to load the list of browser history. *///w w w . j a va2s . c o m private static ArrayList<BookmarkInfo> loadBrowserHistory(Launcher context) { ArrayList<BookmarkInfo> bookmarks = new ArrayList<BookmarkInfo>(); Cursor cursor = context.managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION, null, null, Browser.BookmarkColumns.DATE + " DESC"); if (cursor != null) { int count = 0; cursor.moveToFirst(); if (cursor.moveToFirst() && cursor.getCount() > 0) { while (cursor.isAfterLast() == false) { String title = cursor.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX); String url = cursor.getString(Browser.HISTORY_PROJECTION_URL_INDEX); String bookmarkIndex = cursor.getString(Browser.HISTORY_PROJECTION_BOOKMARK_INDEX); Log.d(LOG_TAG, "bookmarkIndex=" + bookmarkIndex); if (url != null && title != null && !bookmarkIndex.equals("1")) { // check for duplicates boolean found = false; for (BookmarkInfo bookmarkInfo : bookmarks) { if (bookmarkInfo.getUrl() != null && bookmarkInfo.getUrl().equals(url)) { found = true; break; } } if (!found) { BookmarkInfo bookmark = new BookmarkInfo(); bookmark.setTitle(title); bookmark.setUrl(url); bookmarks.add(bookmark); } } cursor.moveToNext(); if (++count >= BROWSER_HISTORY_LIMIT) { break; } } } } return bookmarks; }