Help me learn to use this software with Android Developer websit.

grant1842

Active Member
Licensed User
Longtime User
Help me learn to use this software with Android Developer website.

I am trying to clear history of browser.

I found this link at the android developers websit.
Browser | Android Developers)

B4X:
  public static final void clearHistory (ContentResolver cr)

Since: API Level 1
Delete all entries from the bookmarks/history table which are not bookmarks. Also set all visited bookmarks to unvisited. Requires WRITE_HISTORY_BOOKMARKS
Parameters

cr   The ContentResolver used to access the database.

from the description above what do i need to use in B4C to be able to make a sub clear_History End Sub Procedure.

I am completly new to B4A and need to lean how to use what i see on the android developer site in this B4A software.

THanks for your help.
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can use this code (requires Reflection library):
B4X:
Sub ClearHistory
   Dim r As Reflector
   r.Target = r.GetContext
   r.Target = r.RunMethod("getContentResolver")
   r.RunStaticMethod("android.provider.Browser", _
      "clearHistory", Array As Object(r.Target), Array As String("android.content.ContentResolver"))
End Sub

You will need to add this code to the manifest editor:
B4X:
AddPermission(com.android.browser.permission.READ_HISTORY_BOOKMARKS)
AddPermission(com.android.browser.permission.WRITE_HISTORY_BOOKMARKS)
 
Upvote 0
Top