I have this method but it works only in an activity
public Cursor getXX() {
Cursor mCur = thius.managedQuery(Browser.BOOKMARKS_URI,Browser.HISTORY_PROJECTION,
null, null, null);
}
public void getBrowserHist() {
Cursor mCur = managedQuery(Browser.BOOKMARKS_URI, Browser.HISTORY_PROJECTION,
null, null, null);
mCur.moveToFirst();
if (mCur.moveToFirst() && mCur.getCount() > 0) {
while (mCur.isAfterLast() == false) {
Log.v("titleIdx", mCur.getString(Browser.HISTORY_PROJECTION_TITLE_INDEX));
Log.v("urlIdx", mCur.getString(Browser.HISTORY_PROJECTION_URL_INDEX));
mCur.moveToNext();
}
}
}
How can I use the words "ManagedQuery" in android Service?
How can I create a method to return the cursor to the browser history android system?
managedQuery()
has been deprecated for over two years and is only relevant for Activity
.
Your Service
can call getContentResolver()
, and call query()
on it, to query your desired ContentProvider
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With