# androidx.core.net

*** ** * ** ***

## Classes

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/net/ConnectivityManagerCompat` | Helper for accessing features in `https://developer.android.com/reference/android/net/ConnectivityManager.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/net/MailTo` | MailTo URI parser. |
| `https://developer.android.com/reference/kotlin/androidx/core/net/TrafficStatsCompat` | Helper for accessing features in `https://developer.android.com/reference/android/net/TrafficStats.html`. |
| `https://developer.android.com/reference/kotlin/androidx/core/net/UriCompat` | Helper for accessing function in `https://developer.android.com/reference/android/net/Uri.html` in a backwards compatible fashion. |

## Exceptions

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/net/ParseException` | Thrown when parsing a mailto URI has failed. |

## Extension functions summary

|---|---|
| `https://developer.android.com/reference/java/io/File.html` | `https://developer.android.com/reference/android/net/Uri.html.https://developer.android.com/reference/kotlin/androidx/core/net/package-summary#(android.net.Uri).toFile()()` Creates a `https://developer.android.com/reference/java/io/File.html` from the given `https://developer.android.com/reference/android/net/Uri.html`. |
| `inline https://developer.android.com/reference/android/net/Uri.html` | `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html.https://developer.android.com/reference/kotlin/androidx/core/net/package-summary#(kotlin.String).toUri()()` Creates a Uri from the given encoded URI string. |
| `inline https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/java/io/File.html.https://developer.android.com/reference/kotlin/androidx/core/net/package-summary#(java.io.File).toUri()()` Creates a Uri from the given file. |

## Extension functions

### Uri.toFile

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/net/Uri.kt+function:toFile) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
fun Uri.toFile(): File
```

Creates a `https://developer.android.com/reference/java/io/File.html` from the given `https://developer.android.com/reference/android/net/Uri.html`. Note that this will throw an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-argument-exception/index.html` when invoked on a `https://developer.android.com/reference/android/net/Uri.html` that lacks `file` scheme.

### String.toUri

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/net/Uri.kt+function:toUri) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun String.toUri(): Uri
```

Creates a Uri from the given encoded URI string.

| See also |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html#parse(java.lang.String)` |   |

### File.toUri

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/net/Uri.kt+function:toUri) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
inline fun File.toUri(): Uri
```

Creates a Uri from the given file.

| See also |
|---|---|
| `https://developer.android.com/reference/android/net/Uri.html#fromFile(java.io.File)` |   |