# TileUiClient

# TileUiClient

Artifact:[androidx.wear.tiles:tiles-renderer](https://developer.android.com/jetpack/androidx/releases/wear-tiles)  
[View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/manager/TileUiClient.kt+class:androidx.wear.tiles.manager.TileUiClient)  
Added in[1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.0.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/tiles/manager/TileUiClient "View this page in Java")

<br />

```
class TileUiClient : AutoCloseable
```

<br />

*** ** * ** ***

UI client for a single tile. This handles binding to a Tile Service, and inflating the given tile contents into the provided parentView. This also handles requested updates, re-fetching the tile on-demand.

After creation, you should call {@link #connect} to connect and start the initial fetch. Likewise, when the owning activity is destroyed, you should call {@link #close} to disconnect and release resources.

## Summary

|                                                                                                                                                                                                                                                ### Public constructors                                                                                                                                                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [TileUiClient](https://developer.android.com/reference/kotlin/androidx/wear/tiles/manager/TileUiClient#TileUiClient(android.content.Context,android.content.ComponentName,android.view.ViewGroup))`(` ` context: `[Context](https://developer.android.com/reference/android/content/Context.html)`,` ` component: `[ComponentName](https://developer.android.com/reference/android/content/ComponentName.html)`,` ` parentView: `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup.html) `)` |

|                                 ### Public functions                                 |
|--------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | `@`[MainThread](https://developer.android.com/reference/kotlin/androidx/annotation/MainThread) [close](https://developer.android.com/reference/kotlin/androidx/wear/tiles/manager/TileUiClient#close())`()` Shut down this {@link TileManager}.      |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[MainThread](https://developer.android.com/reference/kotlin/androidx/annotation/MainThread) [connect](https://developer.android.com/reference/kotlin/androidx/wear/tiles/manager/TileUiClient#connect())`()` Initialize this {@link TileManager}. |

## Public constructors

### TileUiClient

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

```
TileUiClient(
    context: Context,
    component: ComponentName,
    parentView: ViewGroup
)
```  

## Public functions

### close

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

```
@MainThread
open fun close(): Unit
```

Shut down this {@link TileManager}. This will cancel any scheduled updates, and close the connection with the tile service.  

### connect

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

```
@MainThread
fun connect(): Unit
```

Initialize this {@link TileManager}. This will cause the {@link TileManager} to connect to the tile service and request the first tile. It will also trigger any requested updates.