# ShareData

Artifact: [androidx.browser:browser](https://developer.android.com/jetpack/androidx/releases/browser) [View Source](https://cs.android.com/search?q=file:androidx/browser/trusted/sharing/ShareData.java+class:androidx.browser.trusted.sharing.ShareData) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

*** ** * ** ***


```
public final class ShareData
```

<br />

*** ** * ** ***

Contains data to be delivered to a Web Share Target via a Trusted Web Activity. See `https://developer.android.com/reference/androidx/browser/trusted/TrustedWebActivityIntentBuilder#setShareParams(androidx.browser.trusted.sharing.ShareTarget,androidx.browser.trusted.sharing.ShareData)`.

## Summary

| ### Constants |
|---|---|
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#KEY_TEXT() = "androidx.browser.trusted.sharing.KEY_TEXT"` Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#text()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#KEY_TITLE() = "androidx.browser.trusted.sharing.KEY_TITLE"` Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#title()`. |
| `static final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#KEY_URIS() = "androidx.browser.trusted.sharing.KEY_URIS"` Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#uris()`. |

| ### Public fields |
|---|---|
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#text()` Text of the shared message. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#title()` Title of the shared message. |
| `final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html>` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#uris()` URIs of files to be shared. |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#ShareData(java.lang.String,java.lang.String,java.util.List<android.net.Uri>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html title, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html text, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html> uris )` Creates a `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData` with the given parameters. |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#fromBundle(android.os.Bundle)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html bundle)` Unpacks the object from a `https://developer.android.com/reference/android/os/Bundle.html`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#toBundle()()` Packs the object into a `https://developer.android.com/reference/android/os/Bundle.html` |

## Constants

### KEY_TEXT

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String KEY_TEXT = "androidx.browser.trusted.sharing.KEY_TEXT"
```

Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#text()`.

### KEY_TITLE

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String KEY_TITLE = "androidx.browser.trusted.sharing.KEY_TITLE"
```

Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#title()`.

### KEY_URIS

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static final String KEY_URIS = "androidx.browser.trusted.sharing.KEY_URIS"
```

Bundle key for `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#uris()`.

## Public fields

### text

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public final @Nullable String text
```

Text of the shared message.

### title

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public final @Nullable String title
```

Title of the shared message.

### uris

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public final @Nullable List<Uri> uris
```

URIs of files to be shared.

## Public constructors

### ShareData

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public ShareData(
    @Nullable String title,
    @Nullable String text,
    @Nullable List<Uri> uris
)
```

Creates a `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData` with the given parameters.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html title` | The `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#title()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/String.html text` | The `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#text()`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/android/net/Uri.html> uris` | The `https://developer.android.com/reference/androidx/browser/trusted/sharing/ShareData#uris()`. |

## Public methods

### fromBundle

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public static @NonNull ShareData fromBundle(@NonNull Bundle bundle)
```

Unpacks the object from a `https://developer.android.com/reference/android/os/Bundle.html`.

### toBundle

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/browser#1.2.0)

```
public @NonNull Bundle toBundle()
```

Packs the object into a `https://developer.android.com/reference/android/os/Bundle.html`