Showing posts from April, 2011

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

You also need to put the permission,

<uses-permission android:name="" />

Screen shot

Get the complete source code from here

Custom Adapter crashes

Wehen I created a custom adapter for a listView, with each list item inflating from a layout. using the statement,

convertView = vi.inflate(R.layout.list_item, parent);

my application crashed, later I put a false to the statement and worked well. The new statement looks like

convertView = vi.inflate(R.layout.list_item, parent, false);