Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Browser.BOOKMARKS_URI not working in Android Studio

I have a project developed in Eclipse. Now I have to make some changes in it and I am not using Eclipse now.
But after creating the same project in Android Studio I am not able to use

  • Browser.BOOKMARKS_URI
  • Browser.BookmarkColumns.BOOKMARK
  • Browser.BookmarkColumns.VISITS
  • Browser.clearHistory(getContentResolver());

UPDATE

It shows following errors:

  • Cannot resolve: "BOOKMARKS_URI"

  • Cannot resolve: "BookmarkColumns"

  • Cannot resolve: "clearHistory()"

Please help me...

like image 302
Safeer Avatar asked Sep 12 '15 04:09

Safeer


2 Answers

use this instead of accessing directly from browser Because Once i had the same issue and solved it by this hope it will help you

public final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
public final String[] HISTORY_PROJECTION = new String[]{
            "_id", // 0
            "url", // 1
            "visits", // 2
            "date", // 3
            "bookmark", // 4
            "title", // 5
            "favicon", // 6
            "thumbnail", // 7
            "touch_icon", // 8
            "user_entered", // 9
    };
public final int HISTORY_PROJECTION_TITLE_INDEX = 5;
public final int HISTORY_PROJECTION_URL_INDEX = 1;
like image 57
Mustanser Iqbal Avatar answered Oct 15 '22 14:10

Mustanser Iqbal


Try this alternative way for those who still didn't found a way to get browser history:

public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");

like image 27
Lokesh Jain Avatar answered Oct 15 '22 12:10

Lokesh Jain