# TabHost.TabSpec

Added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Deprecated in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Methods](https://developer.android.com/reference/android/widget/TabHost.TabSpec#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/widget/TabHost.TabSpec#inhmethods)  

# TabHost.TabSpec

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/widget/TabHost.TabSpec "View this page in Kotlin")\|Java

`
public


class
TabHost.TabSpec
`  
`

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


``


`

|---|--------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.widget.TabHost.TabSpec |

<br />

*** ** * ** ***

A tab has a tab indicator, content, and a tag that is used to keep track of it. This builder helps choose among these options. For the tab indicator, your choices are: 1) set a label 2) set a label and an icon For the tab content, your choices are: 1) the id of a[View](https://developer.android.com/reference/android/view/View)2) a[TabContentFactory](https://developer.android.com/reference/android/widget/TabHost.TabContentFactory)that creates the[View](https://developer.android.com/reference/android/view/View)content. 3) an[Intent](https://developer.android.com/reference/android/content/Intent)that launches an[Activity](https://developer.android.com/reference/android/app/Activity).

## Summary

|                                                                                                                                                                                                                                                              ### Public methods                                                                                                                                                                                                                                                              ||
|----------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[String](https://developer.android.com/reference/java/lang/String)                        | ` `[getTag](https://developer.android.com/reference/android/widget/TabHost.TabSpec#getTag())`() ` Returns the tag for this tab specification.                                                                                                                                                                                                                                                                                                  |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setContent](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setContent(android.content.Intent))`(`[Intent](https://developer.android.com/reference/android/content/Intent)` intent) ` Specify an intent to use to launch an activity as the tab content.                                                                                                                                                            |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setContent](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setContent(android.widget.TabHost.TabContentFactory))`(`[TabHost.TabContentFactory](https://developer.android.com/reference/android/widget/TabHost.TabContentFactory)` contentFactory) ` Specify a[TabHost.TabContentFactory](https://developer.android.com/reference/android/widget/TabHost.TabContentFactory)to use to create the content of the tab. |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setContent](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setContent(int))`(int viewId) ` Specify the id of the view that should be used as the content of the tab.                                                                                                                                                                                                                                               |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setIndicator](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setIndicator(android.view.View))`(`[View](https://developer.android.com/reference/android/view/View)` view) ` Specify a view as the tab indicator.                                                                                                                                                                                                    |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setIndicator](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setIndicator(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` label) ` Specify a label as the tab indicator.                                                                                                                                                                                |
| ` `[TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | ` `[setIndicator](https://developer.android.com/reference/android/widget/TabHost.TabSpec#setIndicator(java.lang.CharSequence,%20android.graphics.drawable.Drawable))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` label, `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable)` icon) ` Specify a label and icon as the tab indicator.                                  |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public methods

### getTag

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

```
public String getTag ()
```

Returns the tag for this tab specification.

<br />

|                                                                  Returns                                                                  ||
|--------------------------------------------------------------------|-----------------------------------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | the tag for this tab specification This value cannot be`null`. <br /> |

### setContent

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

```
public TabHost.TabSpec setContent (Intent intent)
```

Specify an intent to use to launch an activity as the tab content.

<br />

|        Parameters         ||
|----------|-----------------|
| `intent` | `Intent` <br /> |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |

### setContent

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

```
public TabHost.TabSpec setContent (TabHost.TabContentFactory contentFactory)
```

Specify a[TabHost.TabContentFactory](https://developer.android.com/reference/android/widget/TabHost.TabContentFactory)to use to create the content of the tab.

<br />

|                      Parameters                      ||
|------------------|------------------------------------|
| `contentFactory` | `TabHost.TabContentFactory` <br /> |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |

### setContent

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

```
public TabHost.TabSpec setContent (int viewId)
```

Specify the id of the view that should be used as the content of the tab.

<br />

|       Parameters       ||
|----------|--------------|
| `viewId` | `int` <br /> |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |

### setIndicator

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

```
public TabHost.TabSpec setIndicator (View view)
```

Specify a view as the tab indicator.

<br />

|      Parameters       ||
|--------|---------------|
| `view` | `View` <br /> |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |

### setIndicator

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

```
public TabHost.TabSpec setIndicator (CharSequence label)
```

Specify a label as the tab indicator.

<br />

|           Parameters           ||
|---------|-----------------------|
| `label` | `CharSequence` <br /> |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |

### setIndicator

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

```
public TabHost.TabSpec setIndicator (CharSequence label, 
                Drawable icon)
```

Specify a label and icon as the tab indicator.

<br />

|           Parameters           ||
|---------|-----------------------|
| `label` | `CharSequence` <br /> |
| `icon`  | `Drawable` <br />     |

|                                              Returns                                              ||
|-------------------------------------------------------------------------------------------|--------|
| [TabHost.TabSpec](https://developer.android.com/reference/android/widget/TabHost.TabSpec) | <br /> |