# ComplicationText

Summary: [Nested Classes](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#nestedclasses) \| [Constants](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#constants) \| [Inherited Constants](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#inhconstants) \| [Fields](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#lfields) \| [Methods](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText#inhmethods)  

# ComplicationText


`
public


class
ComplicationText
`


`

extends `[Object](http://developer.android.com/reference/java/lang/Object.html)`


`

`


implements

`[Parcelable](http://developer.android.com/reference/android/os/Parcelable.html)`,

`[Parcelable](http://developer.android.com/reference/android/os/Parcelable.html)`


`

|---|---------------------------------------------------------|
| [java.lang.Object](http://developer.android.com/reference/java/lang/Object.html) ||
| ↳ | android.support.wearable.complications.ComplicationText |

<br />

*** ** * ** ***


**This class is deprecated.**   

use the [Jetpack Wear
Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface) libraries instead.

Represents a piece of text to be shown in a complication.

ComplicationText can be a plain string or it can contain a time-dependent value, for which the
value varies depending on the current date/time.

Instances of this class should be obtained either by calling [plainText(CharSequence)](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#plainText(java.lang.CharSequence)), or by using
one of the provided builders: [ComplicationText.TimeDifferenceBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeDifferenceBuilder.html) or [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html).

## Summary

|                                                                                                                                                              ### Nested classes                                                                                                                                                               ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` class`      | [ComplicationText.TimeDifferenceBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeDifferenceBuilder.html) *This class is deprecated. use the [Jetpack Wear Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface) libraries instead.*  |
| ` @interface` | [ComplicationText.TimeDifferenceStyle](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeDifferenceStyle.html) *This @interface is deprecated. use the [Jetpack Wear Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface) libraries instead.* |
| ` class`      | [ComplicationText.TimeFormatBuilder](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatBuilder.html) *This class is deprecated. use the [Jetpack Wear Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface) libraries instead.*          |
| ` @interface` | [ComplicationText.TimeFormatStyle](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.TimeFormatStyle.html) *This @interface is deprecated. use the [Jetpack Wear Watch Face](https://developer.android.com/jetpack/androidx/releases/wear-watchface) libraries instead.*         |

|                                                                                                                                                                                     ### Constants                                                                                                                                                                                      ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [DIFFERENCE_STYLE_SHORT_DUAL_UNIT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_SHORT_DUAL_UNIT) Style for time differences shown in a short alpha-numeric style, with up to two significant units included.                                                                                           |
| `int` | [DIFFERENCE_STYLE_SHORT_SINGLE_UNIT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_SHORT_SINGLE_UNIT) Style for time differences shown in a short alpha-numeric style, with only the most significant unit included.                                                                                    |
| `int` | [DIFFERENCE_STYLE_SHORT_WORDS_SINGLE_UNIT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_SHORT_WORDS_SINGLE_UNIT) Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included, that should fit within the character limit for a short text field. |
| `int` | [DIFFERENCE_STYLE_STOPWATCH](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_STOPWATCH) Style for time differences shown in a numeric fashion like a timer.                                                                                                                                               |
| `int` | [DIFFERENCE_STYLE_WORDS_SINGLE_UNIT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_WORDS_SINGLE_UNIT) Style for time differences shown using (possibly abbreviated) words, with only the most significant unit included.                                                                                |
| `int` | [FORMAT_STYLE_DEFAULT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_DEFAULT) Style where the formatted date/time should be shown unchanged.                                                                                                                                                                |
| `int` | [FORMAT_STYLE_LOWER_CASE](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_LOWER_CASE) Style where the formatted date/time should be shown in lower case.                                                                                                                                                      |
| `int` | [FORMAT_STYLE_UPPER_CASE](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#FORMAT_STYLE_UPPER_CASE) Style where the formatted date/time should be capitalized.                                                                                                                                                              |

|                                                                          ### Inherited constants                                                                           |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface `android.os.Parcelable` |-------|---------------------------------| | `int` | `CONTENTS_FILE_DESCRIPTOR`      | | `int` | `PARCELABLE_WRITE_RETURN_VALUE` | |

|                                                                                                                                                                             ### Fields                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](http://developer.android.com/reference/android/os/Parcelable.Creator.html)`<`[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html)`>` | [CREATOR](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#CREATOR) |

|                                                                                                                                                                                                                                                                                                                                                           ### Public methods                                                                                                                                                                                                                                                                                                                                                            ||
|------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` int`                                                                                                                             | ` `[describeContents](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#describeContents())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html)                                              | ` `[getText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#getText(android.content.Context,%20long))`(`[Context](http://developer.android.com/reference/android/content/Context.html)` context, long dateTimeMillis) `                                                                                                                                                                                                                                                                                                                       |
| ` static `[CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html)                                       | ` `[getText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#getText(android.content.Context,%20android.support.wearable.complications.ComplicationText,%20long))`(`[Context](http://developer.android.com/reference/android/content/Context.html)` context, `[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html)` complicationText, long dateTimeMillis) ` Returns `complicationText.getText(dateTimeMillis, res)` if `complicationText` is not null, or null otherwise. |
| ` boolean`                                                                                                                         | ` `[isAlwaysEmpty](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#isAlwaysEmpty())`() ` Returns true if [getText(Context, long)](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#getText(android.content.Context,%20long)) will return the empty string for any input.                                                                                                                                                                                                                   |
| ` static `[ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html) | ` `[plainText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#plainText(java.lang.CharSequence))`(`[CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html)` text) ` Returns a ComplicationText object that will display the given `text` for any input time.                                                                                                                                                                                                                                                       |
| ` boolean`                                                                                                                         | ` `[returnsSameText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#returnsSameText(long,%20long))`(long firstDateTimeMillis, long secondDateTimeMillis) `                                                                                                                                                                                                                                                                                                                                                                                    |
| ` void`                                                                                                                            | ` `[writeToParcel](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](http://developer.android.com/reference/android/os/Parcel.html)` out, int flags) `                                                                                                                                                                                                                                                                                                                                       |

| ### Inherited methods |
|-----------------------|---|
| From class ` `[java.lang.Object](http://developer.android.com/reference/java/lang/Object.html)` ` |------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------| | ` `[Object](http://developer.android.com/reference/java/lang/Object.html)          | ` clone() `                                                                               | | ` boolean`                                                                         | ` equals(`[Object](http://developer.android.com/reference/java/lang/Object.html)` arg0) ` | | ` void`                                                                            | ` finalize() `                                                                            | | ` final `[Class](http://developer.android.com/reference/java/lang/Class.html)`<?>` | ` getClass() `                                                                            | | ` int`                                                                             | ` hashCode() `                                                                            | | ` final void`                                                                      | ` notify() `                                                                              | | ` final void`                                                                      | ` notifyAll() `                                                                           | | ` `[String](http://developer.android.com/reference/java/lang/String.html)          | ` toString() `                                                                            | | ` final void`                                                                      | ` wait(long arg0, int arg1) `                                                             | | ` final void`                                                                      | ` wait(long arg0) `                                                                       | | ` final void`                                                                      | ` wait() `                                                                                | ||
| From interface ` `[android.os.Parcelable](http://developer.android.com/reference/android/os/Parcelable.html)` ` |------------------|-------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` describeContents() `                                                                                      | | ` abstract void` | ` writeToParcel(`[Parcel](http://developer.android.com/reference/android/os/Parcel.html)` arg0, int arg1) ` | ||

## Constants

### DIFFERENCE_STYLE_SHORT_DUAL_UNIT

```
public static final int DIFFERENCE_STYLE_SHORT_DUAL_UNIT
```

Style for time differences shown in a short alpha-numeric style, with up to two significant
units included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `2m`
for 2 minutes. Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as hours and minutes, such as `4h 2m` for 4 hours and 2 minutes.

If `1 day <= t < 10 days`, the value will be shown as days and hours, such as `3d 4h` for 3 days 4 hours.

If `10 days <= t`, the value will be shown as a number of days, such as `13d`
for 13 days.

The characters used will be localised to match the default locale. If the representation of
the time difference with two units would be too long in the default locale, just a single unit
may be shown instead.

<br />

Constant Value:

3
(0x00000003)


### DIFFERENCE_STYLE_SHORT_SINGLE_UNIT

```
public static final int DIFFERENCE_STYLE_SHORT_SINGLE_UNIT
```

Style for time differences shown in a short alpha-numeric style, with only the most significant
unit included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `2m`
for 2 minutes. Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as a number of hours, such as `4h` for 4 hours.

If `1 days <= t`, the value will be shown as a number of days, such as `13d` for
13 days.

The characters used will be localised to match the default locale.

<br />

Constant Value:

2
(0x00000002)


### DIFFERENCE_STYLE_SHORT_WORDS_SINGLE_UNIT

```
public static final int DIFFERENCE_STYLE_SHORT_WORDS_SINGLE_UNIT
```

Style for time differences shown using (possibly abbreviated) words, with only the most
significant unit included, that should fit within the character limit for a short text field.

The output will be the same as for [DIFFERENCE_STYLE_WORDS_SINGLE_UNIT](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#DIFFERENCE_STYLE_WORDS_SINGLE_UNIT), except that
if the text does not fit into the seven character limit then a shorter form will be used
instead, e.g. "1356d" instead of "1356 days".

<br />

Constant Value:

5
(0x00000005)


### DIFFERENCE_STYLE_STOPWATCH

```
public static final int DIFFERENCE_STYLE_STOPWATCH
```

Style for time differences shown in a numeric fashion like a timer.

For time difference `t`:

If `t < 1 hour`, the value will be shown as minutes and seconds, such as `02:35`
for 2 minutes and 35 seconds.

If `1 hour <= t < 1 day`, the value will be shown as hours and minutes, such as `4:02` for 4 hours and 2 minutes, or as `12:02` for 12 hours and 2 minutes.

If `1 day <= t < 10 days`, the value will be shown as days and hours, such as `3d 4h` for 3 days 4 hours.

If `10 days <= t`, the value will be shown as just days, such as `13d` for 13
days.

The characters used will be localised to match the default locale.

<br />

Constant Value:

1
(0x00000001)


### DIFFERENCE_STYLE_WORDS_SINGLE_UNIT

```
public static final int DIFFERENCE_STYLE_WORDS_SINGLE_UNIT
```

Style for time differences shown using (possibly abbreviated) words, with only the most
significant unit included.

For time difference `t`:

If `t < 1 hour`, the value will be shown as a number of minutes, such as `1 min`
for 1 minute or `2 mins` for 2 minutes. Seconds are not displayed.

If `1 hour <= t < 1 day`, the value will be shown as a number of hours, such as `1 hour` for 1 hour or `4 hours` for 4 hours.

If `1 days <= t`, the value will be shown as a number of days, such as `1 day`
for 1 day or `13 days` for 13 days.

The words used will be localised to match the default locale.

<br />

Constant Value:

4
(0x00000004)


### FORMAT_STYLE_DEFAULT

```
public static final int FORMAT_STYLE_DEFAULT
```

Style where the formatted date/time should be shown unchanged.

<br />

Constant Value:

1
(0x00000001)


### FORMAT_STYLE_LOWER_CASE

```
public static final int FORMAT_STYLE_LOWER_CASE
```

Style where the formatted date/time should be shown in lower case.

<br />

Constant Value:

3
(0x00000003)


### FORMAT_STYLE_UPPER_CASE

```
public static final int FORMAT_STYLE_UPPER_CASE
```

Style where the formatted date/time should be capitalized.

<br />

Constant Value:

2
(0x00000002)


## Fields

### CREATOR

```
public static final Creator<ComplicationText> CREATOR
```

<br />

<br />

## Public methods

### describeContents

```
public int describeContents ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### getText

```
public CharSequence getText (Context context, 
                long dateTimeMillis)
```

<br />

<br />

|             Parameters             ||
|------------------|------------------|
| `context`        | `Context` <br /> |
| `dateTimeMillis` | `long` <br />    |

|                                          Returns                                           ||
|------------------------------------------------------------------------------------|--------|
| [CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html) | <br /> |

### getText

```
public static CharSequence getText (Context context, 
                ComplicationText complicationText, 
                long dateTimeMillis)
```

Returns `complicationText.getText(dateTimeMillis, res)` if `complicationText` is
not null, or null otherwise.

<br />

|                  Parameters                   ||
|--------------------|---------------------------|
| `context`          | `Context` <br />          |
| `complicationText` | `ComplicationText` <br /> |
| `dateTimeMillis`   | `long` <br />             |

|                                          Returns                                           ||
|------------------------------------------------------------------------------------|--------|
| [CharSequence](http://developer.android.com/reference/java/lang/CharSequence.html) | <br /> |

### isAlwaysEmpty

```
public boolean isAlwaysEmpty ()
```

Returns true if [getText(Context, long)](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html#getText(android.content.Context,%20long)) will return the empty string for any input.

<br />

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### plainText

```
public static ComplicationText plainText (CharSequence text)
```

Returns a ComplicationText object that will display the given `text` for any input time.

<br />

|                       Parameters                        ||
|--------|-------------------------------------------------|
| `text` | `CharSequence`: the text to be displayed <br /> |

|                                                             Returns                                                              ||
|--------------------------------------------------------------------------------------------------------------------------|--------|
| [ComplicationText](https://developer.android.com/reference/android/support/wearable/complications/ComplicationText.html) | <br /> |

### returnsSameText

```
public boolean returnsSameText (long firstDateTimeMillis, 
                long secondDateTimeMillis)
```

<br />

<br />

|              Parameters               ||
|------------------------|---------------|
| `firstDateTimeMillis`  | `long` <br /> |
| `secondDateTimeMillis` | `long` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### writeToParcel

```
public void writeToParcel (Parcel out, 
                int flags)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `out`   | `Parcel` <br /> |
| `flags` | `int` <br />    |