Android Question cannot find symbol Browser.BookmarkColumns.TITLE,^

Plutoam

Member
Hello to all friends
I want to use this code but I get an error
What is the problem?
@Roycefer

B4A:
Public Sub GetChromeHistory As String()
    Dim jo As JavaObject
    '     jo = Me       'use from within a class
    jo.InitializeContext   'use from within an activity
    Return jo.RunMethod("GetChromeHistoryJava", Null)
End Sub
#If JAVA
import android.provider.Browser;
import android.net.Uri;
import android.database.Cursor;
import anywheresoftware.b4a.objects.collections.List;


public String[] GetChromeHistoryJava() {
    BA.Log("0");
    String[] proj = new String[] {
        Browser.BookmarkColumns.TITLE,
            Browser.BookmarkColumns.URL,
            Browser.BookmarkColumns.DATE
    };
    BA.Log("1");
    Uri uriCustom = Uri.parse("content://com.android.chrome.browser/bookmarks");
    String sel = Browser.BookmarkColumns.BOOKMARK + " = 0"; // 0 = history, 1 = bookmark
    Cursor mCur = getContentResolver().query(uriCustom, proj, sel, null, null);
    @SuppressWarnings("unused")
    String title = "";
    @SuppressWarnings("unused")
    String url = "";
    @SuppressWarnings("unused")
    String date = "";
    List res = new List();
    res.Initialize();

    if (mCur.moveToFirst() && mCur.getCount() > 0) {
        boolean cont = true;

        while (mCur.isAfterLast() == false && cont) {
            BA.Log("position: " + mCur.getPosition());
            title = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.TITLE));
            url = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.URL));
            BA.Log("2");
            date = mCur.getString(mCur.getColumnIndex(Browser.BookmarkColumns.DATE));
            BA.Log("3");
            res.Add(title + ":" + url + ":" + date);
            mCur.moveToNext();
        }
    }

    mCur.close();
    String[] resArr = new String[res.getSize()];

    for (int i = 0; i < res.getSize(); i++) {
        resArr[i] = (String) res.Get(i);
    }

    return resArr;
}
#End If

Error:
B4A Version: 11.80
Parsing code.    (0.00s)
    Java Version: 11
Building folders structure.    (0.03s)
Compiling code.    (0.02s)
Compiling layouts code.    (0.00s)
Organizing libraries.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.16s)
Linking resources    (1.19s)
Compiling debugger engine code.    (2.90s)
Compiling generated Java code.    Error
B4A line: 149
End Sub
src\com\test\mobin\main.java:597: error: cannot find symbol
        Browser.BookmarkColumns.TITLE,
               ^
  symbol:   variable BookmarkColumns
  location: class Browser
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…