web/static/javadoc/5.3.0/org/acra/attachment/AcraContentProvider.html
org.acra.attachment
All Implemented Interfaces:ComponentCallbacks, ComponentCallbacks2
public classAcraContentProviderextends[ContentProvider](http://d.android.com/reference/android/content/ContentProvider.html?is-external=true "class or interface in android.content")
Provides access to attachments for senders For uri schema, see AcraCore.attachmentUris()
Since:13.03.2017
-
ContentProvider.PipeDataWriter<T>
-
TRIM_MEMORY_BACKGROUND, TRIM_MEMORY_COMPLETE, TRIM_MEMORY_MODERATE, TRIM_MEMORY_RUNNING_CRITICAL, TRIM_MEMORY_RUNNING_LOW, TRIM_MEMORY_RUNNING_MODERATE, TRIM_MEMORY_UI_HIDDEN
Constructors | Constructor and Description |
| --- |
| AcraContentProvider() |
All Methods Static Methods Instance Methods Concrete Methods | Modifier and Type | Method and Description |
| --- | --- |
| int | delete(Uri uri, String selection, String[] selectionArgs) |
| String | getType(Uri uri)
Provides file mimeType
|
| static Uri | getUriForFile(Context context, Directory directory, String relativePath)
Get an uri for this content provider for the given file
|
| static Uri | getUriForFile(Context context, File file)
Get an uri for this content provider for the given file
|
| static String | guessMimeType(Uri uri)
Tries to guess the mime type from uri extension
|
| Uri | insert(Uri uri, ContentValues values) |
| boolean | onCreate() |
| ParcelFileDescriptor | openFile(Uri uri, String mode)
Open a file for read
|
| Cursor | query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder)
Provides file metadata
|
| int | update(Uri uri, ContentValues values, String selection, String[] selectionArgs) |
-
applyBatch, attachInfo, bulkInsert, call, canonicalize, dump, getCallingPackage, getContext, getPathPermissions, getReadPermission, getStreamTypes, getWritePermission, isTemporary, onConfigurationChanged, onLowMemory, onTrimMemory, openAssetFile, openAssetFile, openFile, openFileHelper, openPipeHelper, openTypedAssetFile, openTypedAssetFile, query, query, refresh, setPathPermissions, setReadPermission, setWritePermission, shutdown, uncanonicalize
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public AcraContentProvider()
-
public boolean onCreate()
Specified by:onCreate in class ContentProvider
-
[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")public[Cursor](http://d.android.com/reference/android/database/Cursor.html?is-external=true "class or interface in android.database")query([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")[] projection,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")selection,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")[] selectionArgs,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")sortOrder)
Provides file metadata
Specified by:query in class ContentProviderParameters:uri - the file uriprojection - any combination of OpenableColumns.DISPLAY_NAME and OpenableColumns.SIZEselection - ignoredselectionArgs - ignoredsortOrder - ignoredReturns:file metadata in a cursor with a single row
-
[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")public[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")getType([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri)
Provides file mimeType
Specified by:getType in class ContentProviderParameters:uri - the file uriReturns:mimeType, default is MIME_TYPE_OCTET_STREAMSee Also:guessMimeType(Uri)
-
[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")public[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")insert([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[ContentValues](http://d.android.com/reference/android/content/ContentValues.html?is-external=true "class or interface in android.content")values)
Specified by:insert in class ContentProviderParameters:uri - ignoredvalues - ignoredThrows:UnsupportedOperationException - always
-
public int delete([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")selection,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")[] selectionArgs)
Specified by:delete in class ContentProviderParameters:uri - ignoredselection - ignoredselectionArgs - ignoredThrows:UnsupportedOperationException - always
-
public int update([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[ContentValues](http://d.android.com/reference/android/content/ContentValues.html?is-external=true "class or interface in android.content")values,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")selection,[@Nullable](http://d.android.com/reference/android/support/annotation/Nullable.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")[] selectionArgs)
Specified by:update in class ContentProviderParameters:uri - ignoredvalues - ignoredselection - ignoredselectionArgs - ignoredThrows:UnsupportedOperationException - always
-
[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")public[ParcelFileDescriptor](http://d.android.com/reference/android/os/ParcelFileDescriptor.html?is-external=true "class or interface in android.os")openFile([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mode)
throws[FileNotFoundException](http://d.android.com/reference/java/io/FileNotFoundException.html?is-external=true "class or interface in java.io")
Open a file for read
Overrides:openFile in class ContentProviderParameters:uri - the file urimode - ignoredReturns:a ParcelFileDescriptor for the FileThrows:FileNotFoundException - if the file cannot be resolved
-
[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")public static[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")getUriForFile([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[File](http://d.android.com/reference/java/io/File.html?is-external=true "class or interface in java.io")file)
Get an uri for this content provider for the given file
Parameters:context - a contextfile - the fileReturns:the uri
-
[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")public static[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")getUriForFile([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Context](http://d.android.com/reference/android/content/Context.html?is-external=true "class or interface in android.content")context,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Directory](../../../org/acra/file/Directory.html "enum in org.acra.file")directory,[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")relativePath)
Get an uri for this content provider for the given file
Parameters:context - a contextdirectory - the directory, to with the path is relativerelativePath - the file pathReturns:the uri
-
[@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")public static[String](http://d.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")guessMimeType([@NonNull](http://d.android.com/reference/android/support/annotation/NonNull.html?is-external=true "class or interface in android.support.annotation")[Uri](http://d.android.com/reference/android/net/Uri.html?is-external=true "class or interface in android.net")uri)
Tries to guess the mime type from uri extension
Parameters:uri - the uriReturns:the mime type of the uri, with fallback MIME_TYPE_OCTET_STREAM