Android Programming Press on the image to return to the main documentation page.

ContentResolver

List of types:

ContentResolver
ContentValues
Uri

ContentResolver

ContentResolver allows you to interact with other content providers.

Events:

QueryCompleted (Success As Boolean, Crsr As Cursor)
InsertCompleted (Success As Boolean, Uri As Uri)
UpdateCompleted (Success As Boolean, RowsAffected As Int)
DeleteCompleted (Success As Boolean, RowsAffected As Int)
ObserverChange (Uri As Uri)

Members:


  Delete (Uri As android.net.Uri, Where As String, SelectionArgs() As String) As Int

  Initialize (EventName As String)

  Insert (Uri As Uri, Values As android.content.ContentValues) As Uri

  InsertAsync (Uri As Uri, Values As android.content.ContentValues)

  Query (Uri As Uri, Projection() As String, Selection As String, SelectionArgs() As String, SortOrder As String) As CursorWrapper

  QueryAsync (Uri As Uri, Projection() As String, Selection As String, SelectionArgs() As String, SortOrder As String)

  RegisterObserver (Uri As Uri, NotifyForDescendents As Boolean)

  UnregisterObserver (Uri As Uri)

  Update (Uri As android.net.Uri, Values As android.content.ContentValues, Where As String, SelectionArgs() As String) As Int

  UpdateAsync (Uri As android.net.Uri, Values As android.content.ContentValues, Where As String, SelectionArgs() As String)

  UpdateDelete (Uri As android.net.Uri, Where As String, SelectionArgs() As String)

Members description:

Delete (Uri As android.net.Uri, Where As String, SelectionArgs() As String) As Int
Deletes rows based on the given criteria.
Uri - Content Uri.
Where - The selection criteria. Can include question marks.
SelectionArgs - An array of strings that replace the question marks in the Where clause.
Initialize (EventName As String)
Initializes the object and sets the subs that will handle the asynchronous operations.
Insert (Uri As Uri, Values As android.content.ContentValues) As Uri
Inserts a row.
Uri - The content Uri.
Values - The values to insert.
InsertAsync (Uri As Uri, Values As android.content.ContentValues)
Starts an asynchronous insert. The InsertCompleted event will be raised when operation completes.
Query (Uri As Uri, Projection() As String, Selection As String, SelectionArgs() As String, SortOrder As String) As CursorWrapper
Queries the content provider.
Uri - Content Uri.
Project - An array of strings. The columns to return.
Selection - The criteria.
SelectionArgs - An array of strings that replace question marks in the selection string.
SortOrder - The sorting column (or empty string if sorting is not required).
QueryAsync (Uri As Uri, Projection() As String, Selection As String, SelectionArgs() As String, SortOrder As String)
RegisterObserver (Uri As Uri, NotifyForDescendents As Boolean)
Registers a content observer. The ObserverChange event will be raised whenever there is a change related to the given Uri.
Uri - The Uri to watch for changes.
NotifyForDescendents - Whether to listen to changes related to descendant Uris.
Example:
Sub Process_Globals
  Private cr As ContentResolver
End Sub

Sub Service_Create
  Dim uri As Uri
  uri.Parse("content://com.android.contacts/contacts")
  cr.Initialize("cr")
  cr.RegisterObserver(uri, True)
End Sub

Sub cr_ObserverChange (Uri As Uri)
  Log("Contacts provider has reported a change...")
End Sub
UnregisterObserver (Uri As Uri)
Update (Uri As android.net.Uri, Values As android.content.ContentValues, Where As String, SelectionArgs() As String) As Int
Updates rows with the given values.
Uri - Content Uri.
Values - Values to update.
Where - Selection criteria.
SelectionArgs - An array of strings that replaces questions marks in the Where clause.
UpdateAsync (Uri As android.net.Uri, Values As android.content.ContentValues, Where As String, SelectionArgs() As String)
Starts an asynchronous update. The UpdateCompleted event will be raised when operation completes.
UpdateDelete (Uri As android.net.Uri, Where As String, SelectionArgs() As String)
Starts an asynchronous delete. The DeleteCompleted event will be raised when operation completes.

ContentValues

Holds pairs of keys and values.

Events:

None

Members:


  Initialize

  IsInitialized As Boolean

  PutBoolean (Key As String, Value As Boolean)

  PutByte (Key As String, Value As Byte)

  PutBytes (Key As String, Value() As Byte)

  PutDouble (Key As String, Value As Double)

  PutFloat (Key As String, Value As Float)

  PutInteger (Key As String, Value As Int)

  PutLong (Key As String, Value As Long)

  PutNull (Key As String)

  PutShort (Key As String, Value As Short)

  PutString (Key As String, Value As String)

  Remove (Key As String)

Members description:

Initialize
IsInitialized As Boolean
PutBoolean (Key As String, Value As Boolean)
PutByte (Key As String, Value As Byte)
PutBytes (Key As String, Value() As Byte)
PutDouble (Key As String, Value As Double)
PutFloat (Key As String, Value As Float)
PutInteger (Key As String, Value As Int)
PutLong (Key As String, Value As Long)
PutNull (Key As String)
PutShort (Key As String, Value As Short)
PutString (Key As String, Value As String)
Remove (Key As String)

Uri


Events:

None

Members:


  FromParts (Scheme As String, SSP As String, Fragment As String)

  IsInitialized As Boolean

  Parse (UriString As String)

  ParseId As Long

  WithAppendedId (BaseUri As android.net.Uri, Id As Long)

  WithAppendedPath (BaseUri As android.net.Uri, PathSegment As String)

Members description:

FromParts (Scheme As String, SSP As String, Fragment As String)
Creates a new Uri from the given parts.
IsInitialized As Boolean
Parse (UriString As String)
Creates a new Uri from the given string.
ParseId As Long
Returns the Id part of the current Uri.
WithAppendedId (BaseUri As android.net.Uri, Id As Long)
Creates a new Uri by appending the Id to the given Uri.
WithAppendedPath (BaseUri As android.net.Uri, PathSegment As String)
Creates a new Uri by appending the path to the given Uri.
Top