Udostępnij za pośrednictwem


Uri.FromFile(File) Method

Definition

Creates a Uri from a file.

[Android.Runtime.Register("fromFile", "(Ljava/io/File;)Landroid/net/Uri;", "")]
public static Android.Net.Uri? FromFile (Java.IO.File? file);
[<Android.Runtime.Register("fromFile", "(Ljava/io/File;)Landroid/net/Uri;", "")>]
static member FromFile : Java.IO.File -> Android.Net.Uri

Parameters

file
File

Returns

Uri

a Uri for the given file

Attributes

Exceptions

if file is null

Remarks

Creates a Uri from a file. The URI has the form "file://<absolute path>". Encodes path characters with the exception of '/'.

Example: "file:///tmp/android.txt"

Java documentation for android.net.Uri.fromFile(java.io.File).

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