Added in API level 1

android.util


Provides common utility methods such as date/time manipulation, base64 encoders and decoders, string and number conversion methods, and XML utilities.

Interfaces

AttributeSet A collection of attributes, as found associated with a tag in an XML document. 
Dumpable Represents an object whose state can be dumped into a PrintWriter
DumpableContainer Represents a container that manages dumpables
Printer Simple interface for printing text, allowing redirection to various targets. 

Classes

ArrayMap<K, V> ArrayMap is a generic key->value mapping data structure that is designed to be more memory efficient than a traditional HashMap
ArraySet<E> ArraySet is a generic set data structure that is designed to be more memory efficient than a traditional HashSet
AtomicFile Helper class for performing atomic operations on a file by writing to a new file and renaming it into the place of the original file after the write has successfully completed. 
Base64 Utilities for encoding and decoding the Base64 representation of binary data. 
Base64InputStream An InputStream that does Base64 decoding on the data read through it. 
Base64OutputStream An OutputStream that does Base64 encoding on the data written to it, writing the resulting data to another OutputStream. 
CloseGuard CloseGuard is a mechanism for flagging implicit finalizer cleanup of resources that should have been cleaned up by explicit close methods (aka "explicit termination methods" in Effective Java). 
Config This class was deprecated in API level 14. This class is not useful, it just returns the same value for all constants, and has always done this. Do not use it. 
DebugUtils

Various utilities for debugging and logging. 

DisplayMetrics A structure describing general information about a display, such as its size, density, and font scaling. 
EventLog Access to the system diagnostic event record. 
EventLog.Event A previously logged event read from the logs. 
EventLogTags This class was deprecated in API level 9. This class is no longer functional. Use EventLog instead. 
EventLogTags.Description  
FloatMath This class was deprecated in API level 22. Use Math instead. 
FloatProperty<T> An implementation of Property to be used specifically with fields of type float
Half

The Half class is a wrapper and a utility class to manipulate half-precision 16-bit IEEE 754 floating point data types (also called fp16 or binary16). 

IntProperty<T> An implementation of Property to be used specifically with fields of type int
JsonReader Reads a JSON (RFC 4627) encoded value as a stream of tokens. 
JsonWriter Writes a JSON (RFC 4627) encoded value to a stream, one token at a time. 
LayoutDirection A class for defining layout directions. 
Log API for sending log output. 
LogPrinter Implementation of a Printer that sends its output to the system log. 
LongSparseArray<E> SparseArray mapping longs to Objects. 
LruCache<K, V> A cache that holds strong references to a limited number of values. 
MonthDisplayHelper Helps answer common questions that come up when displaying a month in a 6 row calendar grid format. 
MutableBoolean This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableByte This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableChar This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableDouble This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableFloat This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableInt This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableLong This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
MutableShort This class was deprecated in API level 28. This class will be removed from a future version of the Android API. 
Pair<F, S> Container to ease passing around a tuple of two objects. 
Patterns Commonly used regular expression patterns. 
PrintStreamPrinter Implementation of a Printer that sends its output to a PrintStream
PrintWriterPrinter Implementation of a Printer that sends its output to a PrintWriter
Property<T, V> A property is an abstraction that can be used to represent a mutable value that is held in a host object. 
Range<T extends Comparable<? super T>> Immutable class for describing the range of two numeric values. 
Rational

An immutable data type representation a rational number. 

Size Immutable class for describing width and height dimensions in pixels. 
SizeF Immutable class for describing width and height dimensions in some arbitrary unit. 
SparseArray<E> SparseArray maps integers to Objects and, unlike a normal array of Objects, its indices can contain gaps. 
SparseBooleanArray SparseBooleanArrays map integers to booleans. 
SparseIntArray SparseIntArrays map integers to integers. 
SparseLongArray SparseLongArrays map integers to longs. 
StateSet State sets are arrays of positive ints where each element represents the state of a View (e.g. 
StatsLog StatsLog provides an API for developers to send events to statsd. 
StringBuilderPrinter Implementation of a Printer that sends its output to a StringBuilder
TimeUtils A class containing utility methods related to time zones. 
TimingLogger This class was deprecated in API level 30. Use Trace, or Android Studio. In general, milliseconds is the wrong granularity for method-level tracing. Rounding errors can overemphasize cheap operations, or underemphasize repeated operations. This timing system also does not take CPU scheduling or frequency into account. 
TypedValue Container for a dynamically typed data value. 
Xml XML utility methods. 

Enums

JsonToken A structure, name or value type in a JSON-encoded string. 
Xml.Encoding Supported character encodings. 

Exceptions

AndroidException Base class for all checked exceptions thrown by the Android frameworks. 
AndroidRuntimeException Base class for all unchecked exceptions thrown by the Android frameworks. 
Base64DataException This exception is thrown by Base64InputStream or Base64OutputStream when an error is detected in the data being decoded. 
MalformedJsonException Thrown when a reader encounters malformed JSON. 
NoSuchPropertyException Thrown when code requests a Property on a class that does not expose the appropriate method or field. 
TimeFormatException