在我的应用程序中,我正在获取默认浏览器中可用的所有书签并将其填充到列表视图中。我想要的是,当我单击特定的 listItem(bookmark) 时,它应该直接在默认浏览器中打开该书签。
String[] requestedColumns = { Browser.BookmarkColumns.TITLE,
Browser.BookmarkColumns.VISITS,
Browser.BookmarkColumns.BOOKMARK };
@SuppressWarnings("deprecation")
Cursor faves = managedQuery(Browser.BOOKMARKS_URI, requestedColumns,
Browser.BookmarkColumns.BOOKMARK + "=1", null,
Browser.BookmarkColumns.VISITS);
Log.d("Bookmarks", "Bookmarks count: " + faves.getCount());
int titleIdx = faves.getColumnIndex(Browser.BookmarkColumns.TITLE);
String url[] = new String[] {android.provider.Browser.BookmarkColumns.URL};
Log.d("SimpleBookmarks url", url[0]);
//int url_column_index = faves.getColumnIndexOrThrow(Browser.BookmarkColumns.URL);
faves.moveToFirst();
if (bookmark_check) {
while (!faves.isAfterLast()) {
Log.d("SimpleBookmarks", faves.getString(titleIdx));
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("bookmark", faves.getString(titleIdx));
map.put("url", "");
listitem.add(map);
faves.moveToNext();
}
}
Log.v("data", "" + listitem);
SimpleAdapter listitemAdapter = new SimpleAdapter(this, listitem,
R.layout.list_style, new String[] { "bookmark", "url" },
new int[] { R.id.topTextView, R.id.bottomTextView });
lv.setAdapter(listitemAdapter);