Read bookmark details from Browser provider

Here simply I am reading the contents from the browser provider, bookmark table and listing it in a textView. The contents I am reading here are the title and the URL

The code snippet is,



String[] projection = new String[] { Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.URL };
Cursor mCur = managedQuery(android.provider.Browser.BOOKMARKS_URI,
projection, null, null, null);
mCur.moveToFirst();
int titleIdx = mCur.getColumnIndex(Browser.BookmarkColumns.TITLE);
int urlIdx = mCur.getColumnIndex(Browser.BookmarkColumns.URL);
while (mCur.isAfterLast() == false) {
tv.append("\n" + mCur.getString(titleIdx));
tv.append("\n" + mCur.getString(urlIdx));
mCur.moveToNext();
}



You also need to put the permission,


<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />


Screen shot




Get the complete source code from here

Comments

Popular posts from this blog

AlarmManager and Notification in Android

Swipe Action and ViewFlipper in Android

Open Gallery and get the selected image in appplication