# ActivityFilter

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/embedding/ActivityFilter.kt+class:androidx.window.embedding.ActivityFilter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/window#1.0.0)

*** ** * ** ***

<br />

```
public final class ActivityFilter
```

<br />

*** ** * ** ***

Filter for `https://developer.android.com/reference/androidx/window/embedding/ActivityRule` and `https://developer.android.com/reference/androidx/window/embedding/SplitPlaceholderRule` that checks for component name match when a new activity is started. If the filter matches the started activity `https://developer.android.com/reference/android/content/Intent.html`, the activity will then apply the rule based on the match result. This filter allows a wildcard symbol in the end or instead of the package name, and a wildcard symbol in the end or instead of the class name.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#ActivityFilter(android.content.ComponentName,kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/ComponentName.html componentName, https://developer.android.com/reference/java/lang/String.html intentAction)` Constructs a new `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` using a `https://developer.android.com/reference/android/content/ComponentName.html` and an `https://developer.android.com/reference/android/content/Intent.html` action. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/ComponentName.html` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#getComponentName()()` `https://developer.android.com/reference/android/content/ComponentName.html` that the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` will use to match `https://developer.android.com/reference/android/app/Activity.html` and `https://developer.android.com/reference/android/content/Intent.html`. |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#getIntentAction()()` Action used for activity launch intent. |
| `int` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#hashCode()()` |
| `final boolean` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#matchesActivity(android.app.Activity)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity)` Returns `true` if the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` matches this `https://developer.android.com/reference/android/app/Activity.html`. |
| `final boolean` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#matchesIntent(android.content.Intent)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html intent)` Returns `true` if the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` matches this `https://developer.android.com/reference/android/content/Intent.html`. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter#toString()()` |

## Public constructors

### ActivityFilter

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

```
public ActivityFilter(@NonNull ComponentName componentName, String intentAction)
```

Constructs a new `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` using a `https://developer.android.com/reference/android/content/ComponentName.html` and an `https://developer.android.com/reference/android/content/Intent.html` action.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/ComponentName.html componentName` | Component name in the intent for the activity. Must be non-empty. Can contain a single wildcard at the end. Supported formats: - package/class - `package/*` - `package/suffix.*` - `*/*` |
| `https://developer.android.com/reference/java/lang/String.html intentAction` | Action used for activity launch intent. If it is not `null`, the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` will check the activity `https://developer.android.com/reference/android/content/Intent.html#getAction()` besides the component name. If it is `null`, `https://developer.android.com/reference/android/content/Intent.html#getAction()` will be ignored. |

## Public methods

### equals

```
public boolean equals(Object other)
```

### getComponentName

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

```
public final @NonNull ComponentName getComponentName()
```

`https://developer.android.com/reference/android/content/ComponentName.html` that the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` will use to match `https://developer.android.com/reference/android/app/Activity.html` and `https://developer.android.com/reference/android/content/Intent.html`.

### getIntentAction

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

```
public final String getIntentAction()
```

Action used for activity launch intent.

If it is not `null`, the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` will check the activity `https://developer.android.com/reference/android/content/Intent.html#getAction()` besides the component name. If it is `null`, `https://developer.android.com/reference/android/content/Intent.html#getAction()` will be ignored.

### hashCode

```
public int hashCode()
```

### matchesActivity

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

```
public final boolean matchesActivity(@NonNull Activity activity)
```

Returns `true` if the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` matches this `https://developer.android.com/reference/android/app/Activity.html`. If the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` is created with an intent action, the filter will also compare it with `https://developer.android.com/reference/android/content/Intent.html#getAction()` of `https://developer.android.com/reference/android/app/Activity.html#getIntent()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/app/Activity.html activity` | the `https://developer.android.com/reference/android/app/Activity.html` to test against. |

### matchesIntent

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

```
public final boolean matchesIntent(@NonNull Intent intent)
```

Returns `true` if the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` matches this `https://developer.android.com/reference/android/content/Intent.html`. If the `https://developer.android.com/reference/androidx/window/embedding/ActivityFilter` is created with an intent action, the filter will also compare it with `https://developer.android.com/reference/android/content/Intent.html#getAction()`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Intent.html intent` | the `https://developer.android.com/reference/android/content/Intent.html` to test against. |

### toString

```
public @NonNull String toString()
```