ContentProviderWithCallbacks


public abstract class ContentProviderWithCallbacks<T extends ContentProviderWithCallbacks> extends ContentProvider implements CallbackReceiver


Version of ContentProvider that can be used as a CallbackReceiver. Be sure to call the super of call when unhandled to ensure callbacks are triggered.

Parameters
<T extends ContentProviderWithCallbacks>

Should be specified as the root class (e.g. class X extends ContentProviderWithCallbacks\)

Summary

Public constructors

Public methods

void
attachInfo(Context context, ProviderInfo info)
Bundle
call(String method, String arg, Bundle extras)
T

Creates a RemoteCallback that will call the method with method specified with the arguments specified when triggered.

Inherited Constants

From android.content.ComponentCallbacks2
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Inherited methods

From android.content.ContentProvider
ContentProviderResult[]
applyBatch(
    String authority,
    ArrayList<ContentProviderOperation> operations
)
int
bulkInsert(Uri uri, ContentValues[] values)
Bundle
call(String authority, String method, String arg, Bundle extras)
Uri
final ContentProvider.CallingIdentity
abstract int
delete(Uri p, String p1, String[] p2)
void
dump(FileDescriptor fd, PrintWriter writer, String[] args)
final AttributionSource
final String
final String
final String
final Context
final PathPermission[]
final String
String[]
getStreamTypes(Uri uri, String mimeTypeFilter)
abstract String
String
final String
abstract Uri
boolean
void
void
abstract boolean
void
void
onTrimMemory(int level)
AssetFileDescriptor
openAssetFile(Uri uri, String mode)
ParcelFileDescriptor
openFile(Uri uri, String mode)
final ParcelFileDescriptor
openFileHelper(Uri uri, String mode)
ParcelFileDescriptor
<T> openPipeHelper(
    Uri uri,
    String mimeType,
    Bundle opts,
    T args,
    ContentProvider.PipeDataWriter<T> func
)
AssetFileDescriptor
openTypedAssetFile(Uri uri, String mimeTypeFilter, Bundle opts)
abstract Cursor
query(Uri p, String[] p1, String p2, String[] p3, String p4)
boolean
refresh(Uri uri, Bundle extras, CancellationSignal cancellationSignal)
final Context
final void
final void
setPathPermissions(PathPermission[] permissions)
final void
final void
void
Uri
abstract int
update(Uri p, ContentValues p1, String p2, String[] p3)

Public constructors

ContentProviderWithCallbacks

Added in 1.0.0-alpha02
public ContentProviderWithCallbacks()

Public methods

attachInfo

public void attachInfo(Context context, ProviderInfo info)

call

public Bundle call(String method, String arg, Bundle extras)

createRemoteCallback

Added in 1.0.0-alpha02
public T createRemoteCallback(Context context)

Creates a RemoteCallback that will call the method with method specified with the arguments specified when triggered. Only methods tagged with RemoteCallable can be used here. This method returns a stub implementation of the class calling it to record the arguments/method being used. This should only be used in a chain of 2 calls, starting with createRemoteCallback(), then followed up with a call to any method tagged with RemoteCallable.

    createRemoteCallback().callMyMethod("My arguments", 43, 2.4)
             .toPendingIntent(context);
    \@RemoteCallable
    public RemoteCallback callMyMethod(String argStr, int argInt, double argDouble) {
        ...
        return RemoteCallback.LOCAL;
    }