Search code examples
androiddatabaseandroid-contentproviderbookmarksandroid-browser

Folder hierarchy of bookmarks in Android Browser


I am developing an application for bookmarks management. Currently, I am displaying all the bookmarks in the listview. This approach works well if the number of bookmarks is small. But if there are large number of bookmarks, then the list becomes too long and difficult to locate a particular bookmark. So, I want the user to be able to create folders and move respective bookmarks to the folders. As there is no folder column in the Android bookmarks database, I can't store the information of which bookmarks belongs to which folder.

I can create my own database and maintain this information but then the folder hierarchy won't be visible to the Android. How can I create this folder hierarchy and store this information?


Solution

  • As there is no folder column in the Android bookmarks database, I can't store the information of which bookmarks belongs to which folder.

    But there is. Pulled out the database of browser from emulator running 4.0 and it has a folder field

    enter image description here but when i checked in 2.3 it does not have such a field and I think the application (Bookmarks sort and backup) you mentioned in comment only gives this functionality in 4.0 and above . You can look into the source code also if you are curious the part where the folder is added to db .

      values.put(BrowserContract.Bookmarks.PARENT, mCurrentFolder);
    

    http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android-apps/4.1.1_r1/com/android/browser/AddBookmarkPage.java#AddBookmarkPage

    Hope This helps.