Stay organized with collections Save and categorize content based on your preferences.

HumanReadables

public final class HumanReadables


Text converters for various Android objects.

Summary

Public constructors

Public methods

static String
describe(Cursor c)
static String
describe(View v)

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

static String
getViewHierarchyErrorMessage(
    View rootView,
    List<View> problemViews,
    String errorHeader,
    String problemViewSuffix,
    int maxMsgLen
)

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

static String
getViewHierarchyErrorMessage(
    View rootView,
    List<View> problemViews,
    String errorHeader,
    String problemViewSuffix
)

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

Public constructors

HumanReadables

public HumanReadables()

Public methods

describe

public static String describe(Cursor c)

describe

public static String describe(View v)

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

Parameters
View v

nullable view

Returns
String

a string for human consumption.

getViewHierarchyErrorMessage

public static String getViewHierarchyErrorMessage(
    View rootView,
    List<View> problemViews,
    String errorHeader,
    String problemViewSuffix,
    int maxMsgLen
)

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

Parameters
View rootView

the root of the hierarchy tree to print out.

List<View> problemViews

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.

String errorHeader

the header of the error message (should contain the description of why the error is happening).

String problemViewSuffix

the message to append to the view description in the tree printout. Required if problemViews is supplied. Otherwise, null is acceptable.

int maxMsgLen

the maximum message length. Use Integer#MAX_VALUE to avoid truncating the message.

Returns
String

a string for human consumption.

getViewHierarchyErrorMessage

public static String getViewHierarchyErrorMessage(
    View rootView,
    List<View> problemViews,
    String errorHeader,
    String problemViewSuffix
)

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

Parameters
View rootView

the root of the hierarchy tree to print out.

List<View> problemViews

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.

String errorHeader

the header of the error message (should contain the description of why the error is happening).

String problemViewSuffix

the message to append to the view description in the tree printout. Required if problemViews is supplied. Otherwise, null is acceptable.

Returns
String

a string for human consumption.