Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.provider.PeopleContract.Groups.Query.Builder](https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#) |

Helper class for building structured query argument bundles to pass into `https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#query(android.net.Uri,%20kotlin.Array,%20android.os.Bundle,%20android.os.CancellationSignal)` when querying `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups#CONTENT_URI:android.net.Uri`.

Multiple sub-queries targeting different directory packages or selection criteria can be combined onto a single builder instance before calling `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#build()`.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#Builder()()` Constructs a new empty instance of `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#`. |

| Public methods ||
|---|---|
| [PeopleContract.Groups.Query.Builder](https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#) | `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#addLookupQuery(kotlin.String,%20kotlin.collections.MutableList)(packageName: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html, lookupKeys: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!>)` Adds a sub-query searching for specific group records matching the given list of opaque lookup keys within the specified directory package. |
| [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#) | `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#build()()` Generates the final query arguments `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` containing all configured group sub-queries. |

## Public constructors

### Builder

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
Builder()
```

Constructs a new empty instance of `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#`.

## Public methods

### addLookupQuery

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun addLookupQuery(
    packageName: String, 
    lookupKeys: MutableList<String!>
): PeopleContract.Groups.Query.Builder
```

Adds a sub-query searching for specific group records matching the given list of opaque lookup keys within the specified directory package.

| Parameters ||
|---|---|
| `packageName` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): The package name of the target directory application. This value cannot be `null`. |
| `lookupKeys` | [MutableList](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html)\<[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!\>: A list of group lookup key strings to resolve. This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/provider/PeopleContract.Groups.Query.Builder#` | This builder instance for method chaining. This value cannot be `null`. |

### build

Added in [API level 37.2](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): Bundle
```

Generates the final query arguments `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` containing all configured group sub-queries.

The returned bundle can be passed directly as the query arguments parameter to `https://developer.android.com/reference/kotlin/android/content/ContentResolver.html#query(android.net.Uri,%20kotlin.Array,%20android.os.Bundle,%20android.os.CancellationSignal)`.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` | A `https://developer.android.com/reference/kotlin/android/os/Bundle.html#` containing the accumulated query requests under `https://developer.android.com/reference/kotlin/android/provider/PeopleContract#QUERY_ARG_QUERIES:kotlin.String`. This value cannot be `null`. |