Created
November 15, 2013 09:13
-
-
Save samma835/7481458 to your computer and use it in GitHub Desktop.
Import bookmarks from the stock Android Browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// retrieve and log bookmarks | |
Cursor results; | |
String[] proj = new String[] | |
{ | |
android.provider.BaseColumns._ID, | |
android.provider.Browser.BookmarkColumns.URL, | |
android.provider.Browser.BookmarkColumns.TITLE | |
}; | |
// other columns available: http://developer.android.com/reference/android/provider/Browser.BookmarkColumns.html | |
results = managedQuery(android.provider.Browser.BOOKMARKS_URI, proj, | |
android.provider.Browser.BookmarkColumns.BOOKMARK, null, null); | |
int urlColumn= results.getColumnIndex(android.provider.Browser.BookmarkColumns.URL); | |
int titleColumn= results.getColumnIndex(android.provider.Browser.BookmarkColumns.TITLE); | |
String tag = "mytag"; | |
if (results.moveToFirst()) { | |
do { | |
Log.d(tag, results.getString(titleColumn)+": "+results.getString(urlColumn)); | |
} while (results.moveToNext()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment