I am trying to add a bookmark through code to the Android browser. I am able to do that successfully in the emulator, but the same code is not working on the device.
Note: when I query, the bookmarks database, the URL is there. It’s just not able to display in the device.
This is my code snippet
ContentValues cv = new ContentValues();
cv.put(Browser.BookmarkColumns.TITLE, cursor.getString(1));
cv.put(Browser.BookmarkColumns.URL, cursor.getString(2));
cv.put(Browser.BookmarkColumns.BOOKMARK, 1);
Uri u = getContentResolver().insert(Browser.BOOKMARKS_URI,cv);
Where am I going wrong?
I have tested your code snippet and it works, bookmark was added to my Browsers native application (tested on 2.2 HTC Desire). All I had to add to your code was a permission in the AndroidManifest.xml: