Compartir a través de


MediaScannerConnection.ScanFile Method

Definition

Overloads

ScanFile(String, String)

Requests the media scanner to scan a file.

ScanFile(Context, String[], String[], MediaScannerConnection+IOnScanCompletedListener)

Convenience for constructing a MediaScannerConnection, calling #connect on it, and calling #scanFile(String, String) with the given <var>path</var> and <var>mimeType</var> when the connection is established.

ScanFile(String, String)

Requests the media scanner to scan a file.

[Android.Runtime.Register("scanFile", "(Ljava/lang/String;Ljava/lang/String;)V", "GetScanFile_Ljava_lang_String_Ljava_lang_String_Handler")]
public virtual void ScanFile (string? path, string? mimeType);
[<Android.Runtime.Register("scanFile", "(Ljava/lang/String;Ljava/lang/String;)V", "GetScanFile_Ljava_lang_String_Ljava_lang_String_Handler")>]
abstract member ScanFile : string * string -> unit
override this.ScanFile : string * string -> unit

Parameters

path
String

the path to the file to be scanned.

mimeType
String

an optional mimeType for the file. If mimeType is null, then the mimeType will be inferred from the file extension.

Attributes

Remarks

Requests the media scanner to scan a file. Success or failure of the scanning operation cannot be determined until MediaScannerConnectionClient#onScanCompleted(String, Uri) is called.

Java documentation for android.media.MediaScannerConnection.scanFile(java.lang.String, java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

ScanFile(Context, String[], String[], MediaScannerConnection+IOnScanCompletedListener)

Convenience for constructing a MediaScannerConnection, calling #connect on it, and calling #scanFile(String, String) with the given <var>path</var> and <var>mimeType</var> when the connection is established.

[Android.Runtime.Register("scanFile", "(Landroid/content/Context;[Ljava/lang/String;[Ljava/lang/String;Landroid/media/MediaScannerConnection$OnScanCompletedListener;)V", "")]
public static void ScanFile (Android.Content.Context? context, string[]? paths, string[]? mimeTypes, Android.Media.MediaScannerConnection.IOnScanCompletedListener? callback);
[<Android.Runtime.Register("scanFile", "(Landroid/content/Context;[Ljava/lang/String;[Ljava/lang/String;Landroid/media/MediaScannerConnection$OnScanCompletedListener;)V", "")>]
static member ScanFile : Android.Content.Context * string[] * string[] * Android.Media.MediaScannerConnection.IOnScanCompletedListener -> unit

Parameters

context
Context

The caller's Context, required for establishing a connection to the media scanner service. Success or failure of the scanning operation cannot be determined until MediaScannerConnectionClient#onScanCompleted(String, Uri) is called.

paths
String[]

Array of paths to be scanned.

mimeTypes
String[]

Optional array of MIME types for each path. If mimeType is null, then the mimeType will be inferred from the file extension.

callback
MediaScannerConnection.IOnScanCompletedListener

Optional callback through which you can receive the scanned URI and MIME type; If null, the file will be scanned but you will not get a result back.

Attributes

Remarks

Java documentation for android.media.MediaScannerConnection.scanFile(android.content.Context, java.lang.String[], java.lang.String[], android.media.OnScanCompletedListener).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

See also

  • <xref:Android.Media.MediaScannerConnection.ScanFile(System.String%2c+System.String)>

Applies to