Sei sulla pagina 1di 1

shs

When you open a URL using the WebView it gets stored in the phone's web history.

You can access it by using the below code.Later add it to the listview you use in
hi.xml

try{

Cursor mCur = null;


try{
String sortOrder = Browser.BookmarkColumns.DATE + " ASC";
mCur= context.getContentResolver().query(Browser.BOOKMARKS_URI,
Browser.HISTORY_PROJECTION, null, null, sortOrder);

mCur.moveToFirst();
if (mCur.moveToFirst() && mCur.getCount() > 0) {
while (mCur.isAfterLast() == false) {
String title = mCur.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX);
String url = mCur.getString(Browser.HISTORY_PROJECTION_URL_INDEX);
long date = mCur.getLong(Browser.HISTORY_PROJECTION_DATE_INDEX);
mCur.moveToNext();
}
}else{
mCur.close();
}

}catch(Exception e){

}finally{
mCur.close();
}

}catch(Exception e){

Also you need to give the below permission in your manifest file. Hope this helps.

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

Potrebbero piacerti anche