# HumanReadables

# HumanReadables

Artifact:[androidx.test.espresso:espresso-core](https://developer.android.com/jetpack/androidx/releases/test-espresso)  
[View Source](https://cs.android.com/search?q=file:androidx/test/espresso/util/HumanReadables.java+class:androidx.test.espresso.util.HumanReadables)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/test/espresso/util/HumanReadables "View this page in Java")

<br />

```
class HumanReadables
```

<br />

*** ** * ** ***

Text converters for various Android objects.

## Summary

|                                        ### Public functions                                        |
|----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [describe](https://developer.android.com/reference/kotlin/androidx/test/espresso/util/HumanReadables#describe(android.database.Cursor))`(c: `[Cursor](https://developer.android.com/reference/android/database/Cursor.html)`!)`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [describe](https://developer.android.com/reference/kotlin/androidx/test/espresso/util/HumanReadables#describe(android.view.View))`(v: `[View](https://developer.android.com/reference/android/view/View.html)`!)` Transforms an arbitrary view into a string with (hopefully) enough debug info.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [getViewHierarchyErrorMessage](https://developer.android.com/reference/kotlin/androidx/test/espresso/util/HumanReadables#getViewHierarchyErrorMessage(android.view.View,java.util.List<android.view.View>,java.lang.String,java.lang.String))`(` ` rootView: `[View](https://developer.android.com/reference/android/view/View.html)`!,` ` problemViews: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[View](https://developer.android.com/reference/android/view/View.html)`!>!,` ` errorHeader: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` problemViewSuffix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` `)` Prints out an error message featuring the view hierarchy starting at the rootView.                                                                                                |
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | [getViewHierarchyErrorMessage](https://developer.android.com/reference/kotlin/androidx/test/espresso/util/HumanReadables#getViewHierarchyErrorMessage(android.view.View,java.util.List<android.view.View>,java.lang.String,java.lang.String,int))`(` ` rootView: `[View](https://developer.android.com/reference/android/view/View.html)`!,` ` problemViews: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[View](https://developer.android.com/reference/android/view/View.html)`!>!,` ` errorHeader: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` problemViewSuffix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!,` ` maxMsgLen: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) `)` Prints out an error message featuring the view hierarchy starting at the rootView. |

## Public functions

### describe

```
java-static fun describe(c: Cursor!): String!
```  

### describe

```
java-static fun describe(v: View!): String!
```

Transforms an arbitrary view into a string with (hopefully) enough debug info.  

|                                   Parameters                                   |
|--------------------------------------------------------------------------------|---------------|
| `v: `[View](https://developer.android.com/reference/android/view/View.html)`!` | nullable view |

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|---------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | a string for human consumption. |

### getViewHierarchyErrorMessage

```
java-static fun getViewHierarchyErrorMessage(
    rootView: View!,
    problemViews: (Mutable)List<View!>!,
    errorHeader: String!,
    problemViewSuffix: String!
): String!
```

Prints out an error message featuring the view hierarchy starting at the rootView.  

|                                                                                                                                           Parameters                                                                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| `rootView: `[View](https://developer.android.com/reference/android/view/View.html)`!`                                                                                                                                                                                                           | the root of the hierarchy tree to print out.                                                                                             |
| `problemViews: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[View](https://developer.android.com/reference/android/view/View.html)`!>!` | list of the views that you would like to point out are causing the error message or null, if you want to skip this feature.              |
| `errorHeader: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                                                                                                                                                                             | the header of the error message (should contain the description of why the error is happening).                                          |
| `problemViewSuffix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                                                                                                                                                                       | the message to append to the view description in the tree printout. Required if problemViews is supplied. Otherwise, null is acceptable. |

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|---------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | a string for human consumption. |

### getViewHierarchyErrorMessage

```
java-static fun getViewHierarchyErrorMessage(
    rootView: View!,
    problemViews: (Mutable)List<View!>!,
    errorHeader: String!,
    problemViewSuffix: String!,
    maxMsgLen: Int
): String!
```

Prints out an error message featuring the view hierarchy starting at the rootView.  

|                                                                                                                                           Parameters                                                                                                                                            |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| `rootView: `[View](https://developer.android.com/reference/android/view/View.html)`!`                                                                                                                                                                                                           | the root of the hierarchy tree to print out.                                                                                                           |
| `problemViews: (`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[View](https://developer.android.com/reference/android/view/View.html)`!>!` | list of the views that you would like to point out are causing the error message or null, if you want to skip this feature.                            |
| `errorHeader: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                                                                                                                                                                             | the header of the error message (should contain the description of why the error is happening).                                                        |
| `problemViewSuffix: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!`                                                                                                                                                                                       | the message to append to the view description in the tree printout. Required if problemViews is supplied. Otherwise, null is acceptable.               |
| `maxMsgLen: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                                                                                                                                                                                        | the maximum message length. Use[MAX_VALUE](https://developer.android.com/reference/java/lang/Integer.html#MAX_VALUE())to avoid truncating the message. |

|                                       Returns                                        |
|--------------------------------------------------------------------------------------|---------------------------------|
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`!` | a string for human consumption. |