public final class AudioFormat extends Object implements Parcelable
AudioFormat
class is used to access a number of audio format and
channel configuration constants. They are for instance used
in AudioTrack
and AudioRecord
, as valid values in individual parameters of
constructors like AudioTrack.AudioTrack(int, int, int, int, int, int)
, where the fourth
parameter is one of the AudioFormat.ENCODING_*
constants.
The AudioFormat
constants are also used in MediaFormat
to specify
audio related values commonly used in media, such as for MediaFormat.KEY_CHANNEL_MASK
.
The AudioFormat.Builder
class can be used to create instances of
the AudioFormat
format class.
Refer to
AudioFormat.Builder
for documentation on the mechanics of the configuration and building
of such instances. Here we describe the main concepts that the AudioFormat
class
allow you to convey in each instance, they are:
Closely associated with the AudioFormat
is the notion of an
audio frame, which is used throughout the documentation
to represent the minimum size complete unit of audio data.
Expressed in Hz, the sample rate in an AudioFormat
instance expresses the number
of audio samples for each channel per second in the content you are playing or recording. It is
not the sample rate
at which content is rendered or produced. For instance a sound at a media sample rate of 8000Hz
can be played on a device operating at a sample rate of 48000Hz; the sample rate conversion is
automatically handled by the platform, it will not play at 6x speed.
As of API Build.VERSION_CODES.M
,
sample rates up to 192kHz are supported
for AudioRecord
and AudioTrack
, with sample rate conversion
performed as needed.
To improve efficiency and avoid lossy conversions, it is recommended to match the sample rate
for AudioRecord
and AudioTrack
to the endpoint device
sample rate, and limit the sample rate to no more than 48kHz unless there are special
device capabilities that warrant a higher rate.
Audio encoding is used to describe the bit representation of audio data, which can be either linear PCM or compressed audio, such as AC3 or DTS.
For linear PCM, the audio encoding describes the sample size, 8 bits, 16 bits, or 32 bits, and the sample representation, integer or float.
ENCODING_PCM_8BIT
: The audio sample is a 8 bit unsigned integer in the
range [0, 255], with a 128 offset for zero. This is typically stored as a Java byte in a
byte array or ByteBuffer. Since the Java byte is signed,
be careful with math operations and conversions as the most significant bit is inverted.
ENCODING_PCM_16BIT
: The audio sample is a 16 bit signed integer
typically stored as a Java short in a short array, but when the short
is stored in a ByteBuffer, it is native endian (as compared to the default Java big endian).
The short has full range from [-32768, 32767],
and is sometimes interpreted as fixed point Q.15 data.
ENCODING_PCM_FLOAT
: Introduced in
API Build.VERSION_CODES.LOLLIPOP
, this encoding specifies that
the audio sample is a 32 bit IEEE single precision float. The sample can be
manipulated as a Java float in a float array, though within a ByteBuffer
it is stored in native endian byte order.
The nominal range of ENCODING_PCM_FLOAT
audio data is [-1.0, 1.0].
It is implementation dependent whether the positive maximum of 1.0 is included
in the interval. Values outside of the nominal range are clamped before
sending to the endpoint device. Beware that
the handling of NaN is undefined; subnormals may be treated as zero; and
infinities are generally clamped just like other values for AudioTrack
– try to avoid infinities because they can easily generate a NaN.
ENCODING_PCM_FLOAT
for audio capture, processing,
and playback.
Floats are efficiently manipulated by modern CPUs,
have greater precision than 24 bit signed integers,
and have greater dynamic range than 32 bit signed integers.
AudioRecord
as of API Build.VERSION_CODES.M
and
AudioTrack
as of API Build.VERSION_CODES.LOLLIPOP
support ENCODING_PCM_FLOAT
.
For compressed audio, the encoding specifies the method of compression,
for example ENCODING_AC3
and ENCODING_DTS
. The compressed
audio data is typically stored as bytes in
a byte array or ByteBuffer. When a compressed audio encoding is specified
for an AudioTrack
, it creates a direct (non-mixed) track
for output to an endpoint (such as HDMI) capable of decoding the compressed audio.
For (most) other endpoints, which are not capable of decoding such compressed audio,
you will need to decode the data first, typically by creating a MediaCodec
.
Alternatively, one may use MediaPlayer
for playback of compressed
audio files or streams.
When compressed audio is sent out through a direct AudioTrack
,
it need not be written in exact multiples of the audio access unit;
this differs from MediaCodec
input buffers.
Channel masks are used in AudioTrack
and AudioRecord
to describe
the samples and their arrangement in the audio frame. They are also used in the endpoint (e.g.
a USB audio interface, a DAC connected to headphones) to specify allowable configurations of a
particular device.
As of API Build.VERSION_CODES.M
, there are two types of channel masks:
channel position masks and channel index masks.
Build.VERSION_CODES.BASE
.
For input and output, they imply a positional nature - the location of a speaker or a microphone
for recording or playback.
channel count | channel position mask |
1 | CHANNEL_OUT_MONO |
2 | CHANNEL_OUT_STEREO |
3 | CHANNEL_OUT_STEREO | CHANNEL_OUT_FRONT_CENTER |
4 | CHANNEL_OUT_QUAD |
5 | CHANNEL_OUT_QUAD | CHANNEL_OUT_FRONT_CENTER |
6 | CHANNEL_OUT_5POINT1 |
7 | CHANNEL_OUT_5POINT1 | CHANNEL_OUT_BACK_CENTER |
8 | CHANNEL_OUT_7POINT1_SURROUND |
CHANNEL_OUT_STEREO
is composed of CHANNEL_OUT_FRONT_LEFT
and
CHANNEL_OUT_FRONT_RIGHT
.
Build.VERSION_CODES.M
. They allow
the selection of a particular channel from the source or sink endpoint by number, i.e. the first
channel, the second channel, and so forth. This avoids problems with artificially assigning
positions to channels of an endpoint, or figuring what the ith position bit is within
an endpoint's channel position mask etc.
CHANNEL_OUT_QUAD
device, but really one is only interested in channel 0
through channel 3. The USB device would then have the following individual bit channel masks:
CHANNEL_OUT_FRONT_LEFT
,
CHANNEL_OUT_FRONT_RIGHT
, CHANNEL_OUT_BACK_LEFT
and CHANNEL_OUT_BACK_RIGHT
. But which is channel 0 and which is
channel 3?
1 << channelNumber
.
A set bit indicates that channel is present in the audio frame, otherwise it is cleared.
The order of the bits also correspond to that channel number's sample order in the audio frame.
0xF
. Suppose we wanted to select only the first and the third channels; this would
correspond to a channel index mask 0x5
(the first and third bits set). If an
AudioTrack
uses this channel index mask, the audio frame would consist of two
samples, the first sample of each frame routed to channel 0, and the second sample of each frame
routed to channel 2.
The canonical channel index masks by channel count are given by the formula
(1 << channelCount) - 1
.
CHANNEL_OUT_FRONT_LEFT
,
CHANNEL_OUT_FRONT_CENTER
, etc. for HDMI home theater purposes.
AudioTrack
to output movie content, where 5.1 multichannel output is to be written.
AudioRecord
may only want the
third and fourth audio channels of the endpoint (i.e. the second channel pair), and not care the
about position it corresponds to, in which case the channel index mask is 0xC
.
Multichannel AudioRecord
sessions should use channel index masks.
For linear PCM, an audio frame consists of a set of samples captured at the same time,
whose count and
channel association are given by the channel mask,
and whose sample contents are specified by the encoding.
For example, a stereo 16 bit PCM frame consists of
two 16 bit linear PCM samples, with a frame size of 4 bytes.
For compressed audio, an audio frame may alternately
refer to an access unit of compressed data bytes that is logically grouped together for
decoding and bitstream access (e.g. MediaCodec
),
or a single byte of compressed data (e.g. AudioTrack.getBufferSizeInFrames()
),
or the linear PCM frame result from decoding the compressed data
(e.g.AudioTrack.getPlaybackHeadPosition()
),
depending on the context where audio frame is used.
Modifier and Type | Class and Description |
---|---|
static class |
AudioFormat.Builder
Builder class for
AudioFormat objects. |
static interface |
AudioFormat.Encoding |
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static int |
AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_INDEX_MASK |
static int |
AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK |
static int |
AUDIO_FORMAT_HAS_PROPERTY_ENCODING |
static int |
AUDIO_FORMAT_HAS_PROPERTY_NONE |
static int |
AUDIO_FORMAT_HAS_PROPERTY_SAMPLE_RATE |
static int |
CHANNEL_CONFIGURATION_DEFAULT
Deprecated.
Use
CHANNEL_OUT_DEFAULT or CHANNEL_IN_DEFAULT instead. |
static int |
CHANNEL_CONFIGURATION_INVALID
Deprecated.
Use
CHANNEL_INVALID instead. |
static int |
CHANNEL_CONFIGURATION_MONO
Deprecated.
Use
CHANNEL_OUT_MONO or CHANNEL_IN_MONO instead. |
static int |
CHANNEL_CONFIGURATION_STEREO
Deprecated.
Use
CHANNEL_OUT_STEREO or CHANNEL_IN_STEREO instead. |
static int |
CHANNEL_IN_BACK |
static int |
CHANNEL_IN_BACK_PROCESSED |
static int |
CHANNEL_IN_DEFAULT |
static int |
CHANNEL_IN_FRONT |
static int |
CHANNEL_IN_FRONT_BACK |
static int |
CHANNEL_IN_FRONT_PROCESSED |
static int |
CHANNEL_IN_LEFT |
static int |
CHANNEL_IN_LEFT_PROCESSED |
static int |
CHANNEL_IN_MONO |
static int |
CHANNEL_IN_PRESSURE |
static int |
CHANNEL_IN_RIGHT |
static int |
CHANNEL_IN_RIGHT_PROCESSED |
static int |
CHANNEL_IN_STEREO |
static int |
CHANNEL_IN_VOICE_DNLINK |
static int |
CHANNEL_IN_VOICE_UPLINK |
static int |
CHANNEL_IN_X_AXIS |
static int |
CHANNEL_IN_Y_AXIS |
static int |
CHANNEL_IN_Z_AXIS |
static int |
CHANNEL_INVALID
Invalid audio channel mask
|
static int |
CHANNEL_OUT_5POINT1 |
static int |
CHANNEL_OUT_5POINT1_SIDE |
static int |
CHANNEL_OUT_7POINT1
Deprecated.
Not the typical 7.1 surround configuration. Use
CHANNEL_OUT_7POINT1_SURROUND instead. |
static int |
CHANNEL_OUT_7POINT1_SURROUND |
static int |
CHANNEL_OUT_BACK_CENTER |
static int |
CHANNEL_OUT_BACK_LEFT |
static int |
CHANNEL_OUT_BACK_RIGHT |
static int |
CHANNEL_OUT_DEFAULT
Default audio channel mask
|
static int |
CHANNEL_OUT_FRONT_CENTER |
static int |
CHANNEL_OUT_FRONT_LEFT |
static int |
CHANNEL_OUT_FRONT_LEFT_OF_CENTER |
static int |
CHANNEL_OUT_FRONT_RIGHT |
static int |
CHANNEL_OUT_FRONT_RIGHT_OF_CENTER |
static int |
CHANNEL_OUT_LOW_FREQUENCY |
static int |
CHANNEL_OUT_MONO |
static int |
CHANNEL_OUT_QUAD |
static int |
CHANNEL_OUT_QUAD_SIDE |
static int |
CHANNEL_OUT_SIDE_LEFT |
static int |
CHANNEL_OUT_SIDE_RIGHT |
static int |
CHANNEL_OUT_STEREO |
static int |
CHANNEL_OUT_SURROUND |
static int |
CHANNEL_OUT_TOP_BACK_CENTER |
static int |
CHANNEL_OUT_TOP_BACK_LEFT |
static int |
CHANNEL_OUT_TOP_BACK_RIGHT |
static int |
CHANNEL_OUT_TOP_CENTER |
static int |
CHANNEL_OUT_TOP_FRONT_CENTER |
static int |
CHANNEL_OUT_TOP_FRONT_LEFT |
static int |
CHANNEL_OUT_TOP_FRONT_RIGHT |
static Parcelable.Creator<AudioFormat> |
CREATOR |
static int |
ENCODING_AAC_HE_V1
Audio data format: AAC HE V1 compressed
|
static int |
ENCODING_AAC_HE_V2
Audio data format: AAC HE V2 compressed
|
static int |
ENCODING_AAC_LC
Audio data format: AAC LC compressed
|
static int |
ENCODING_AC3
Audio data format: AC-3 compressed
|
static int |
ENCODING_DEFAULT
Default audio data format
|
static int |
ENCODING_DOLBY_TRUEHD
Audio data format: DOLBY TRUEHD compressed
|
static int |
ENCODING_DTS
Audio data format: DTS compressed
|
static int |
ENCODING_DTS_HD
Audio data format: DTS HD compressed
|
static int |
ENCODING_E_AC3
Audio data format: E-AC-3 compressed
|
static int |
ENCODING_IEC61937
Audio data format: compressed audio wrapped in PCM for HDMI
or S/PDIF passthrough.
|
static int |
ENCODING_INVALID
Invalid audio data format
|
static int |
ENCODING_MP3
Audio data format: MP3 compressed
|
static int |
ENCODING_PCM_16BIT
Audio data format: PCM 16 bit per sample.
|
static int |
ENCODING_PCM_8BIT
Audio data format: PCM 8 bit per sample.
|
static int |
ENCODING_PCM_FLOAT
Audio data format: single-precision floating-point per sample
|
static int |
SAMPLE_RATE_HZ_MAX
Maximum value for sample rate,
assuming AudioTrack and AudioRecord share the same limitations.
|
static int |
SAMPLE_RATE_HZ_MIN
Minimum value for sample rate,
assuming AudioTrack and AudioRecord share the same limitations.
|
static int |
SAMPLE_RATE_UNSPECIFIED
Sample rate will be a route-dependent value.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
AudioFormat() |
Modifier and Type | Method and Description |
---|---|
static int |
channelCountFromInChannelMask(int mask) |
static int |
channelCountFromOutChannelMask(int mask) |
static int |
convertChannelOutMaskToNativeMask(int javaMask) |
static int |
convertNativeChannelMaskToOutMask(int nativeMask) |
int |
describeContents()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation.
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
static int[] |
filterPublicFormats(int[] formats)
Returns an array of public encoding values extracted from an array of
encoding values.
|
static int |
getBytesPerSample(int audioFormat) |
int |
getChannelCount()
Return the channel count.
|
int |
getChannelIndexMask()
Return the channel index mask.
|
int |
getChannelMask()
Return the channel mask.
|
int |
getEncoding()
Return the encoding.
|
int |
getPropertySetMask() |
int |
getSampleRate()
Return the sample rate.
|
int |
hashCode()
Returns a hash code value for the object.
|
static int |
inChannelMaskFromOutChannelMask(int outMask) |
static boolean |
isEncodingLinearFrames(int audioFormat) |
static boolean |
isEncodingLinearPcm(int audioFormat) |
static boolean |
isPublicEncoding(int audioFormat) |
static boolean |
isValidEncoding(int audioFormat) |
String |
toString()
Returns a string representation of the object.
|
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final int ENCODING_INVALID
public static final int ENCODING_DEFAULT
public static final int ENCODING_PCM_16BIT
public static final int ENCODING_PCM_8BIT
public static final int ENCODING_PCM_FLOAT
public static final int ENCODING_AC3
public static final int ENCODING_E_AC3
public static final int ENCODING_DTS
public static final int ENCODING_DTS_HD
public static final int ENCODING_MP3
public static final int ENCODING_AAC_LC
public static final int ENCODING_AAC_HE_V1
public static final int ENCODING_AAC_HE_V2
public static final int ENCODING_IEC61937
CHANNEL_OUT_STEREO
.
Data should be written to the stream in a short[] array.
If the data is written in a byte[] array then there may be endian problems
on some platforms when converting to short internally.public static final int ENCODING_DOLBY_TRUEHD
@Deprecated public static final int CHANNEL_CONFIGURATION_INVALID
CHANNEL_INVALID
instead.@Deprecated public static final int CHANNEL_CONFIGURATION_DEFAULT
CHANNEL_OUT_DEFAULT
or CHANNEL_IN_DEFAULT
instead.@Deprecated public static final int CHANNEL_CONFIGURATION_MONO
CHANNEL_OUT_MONO
or CHANNEL_IN_MONO
instead.@Deprecated public static final int CHANNEL_CONFIGURATION_STEREO
CHANNEL_OUT_STEREO
or CHANNEL_IN_STEREO
instead.public static final int CHANNEL_INVALID
public static final int CHANNEL_OUT_DEFAULT
public static final int CHANNEL_OUT_FRONT_LEFT
public static final int CHANNEL_OUT_FRONT_RIGHT
public static final int CHANNEL_OUT_FRONT_CENTER
public static final int CHANNEL_OUT_LOW_FREQUENCY
public static final int CHANNEL_OUT_BACK_LEFT
public static final int CHANNEL_OUT_BACK_RIGHT
public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER
public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER
public static final int CHANNEL_OUT_BACK_CENTER
public static final int CHANNEL_OUT_SIDE_LEFT
public static final int CHANNEL_OUT_SIDE_RIGHT
public static final int CHANNEL_OUT_TOP_CENTER
public static final int CHANNEL_OUT_TOP_FRONT_LEFT
public static final int CHANNEL_OUT_TOP_FRONT_CENTER
public static final int CHANNEL_OUT_TOP_FRONT_RIGHT
public static final int CHANNEL_OUT_TOP_BACK_LEFT
public static final int CHANNEL_OUT_TOP_BACK_CENTER
public static final int CHANNEL_OUT_TOP_BACK_RIGHT
public static final int CHANNEL_OUT_MONO
public static final int CHANNEL_OUT_STEREO
public static final int CHANNEL_OUT_QUAD
public static final int CHANNEL_OUT_QUAD_SIDE
public static final int CHANNEL_OUT_SURROUND
public static final int CHANNEL_OUT_5POINT1
public static final int CHANNEL_OUT_5POINT1_SIDE
@Deprecated public static final int CHANNEL_OUT_7POINT1
CHANNEL_OUT_7POINT1_SURROUND
instead.public static final int CHANNEL_OUT_7POINT1_SURROUND
public static final int SAMPLE_RATE_HZ_MIN
public static final int SAMPLE_RATE_HZ_MAX
public static final int SAMPLE_RATE_UNSPECIFIED
public static final int CHANNEL_IN_DEFAULT
public static final int CHANNEL_IN_LEFT
public static final int CHANNEL_IN_RIGHT
public static final int CHANNEL_IN_FRONT
public static final int CHANNEL_IN_BACK
public static final int CHANNEL_IN_LEFT_PROCESSED
public static final int CHANNEL_IN_RIGHT_PROCESSED
public static final int CHANNEL_IN_FRONT_PROCESSED
public static final int CHANNEL_IN_BACK_PROCESSED
public static final int CHANNEL_IN_PRESSURE
public static final int CHANNEL_IN_X_AXIS
public static final int CHANNEL_IN_Y_AXIS
public static final int CHANNEL_IN_Z_AXIS
public static final int CHANNEL_IN_VOICE_UPLINK
public static final int CHANNEL_IN_VOICE_DNLINK
public static final int CHANNEL_IN_MONO
public static final int CHANNEL_IN_STEREO
public static final int CHANNEL_IN_FRONT_BACK
public static final int AUDIO_FORMAT_HAS_PROPERTY_NONE
public static final int AUDIO_FORMAT_HAS_PROPERTY_ENCODING
public static final int AUDIO_FORMAT_HAS_PROPERTY_SAMPLE_RATE
public static final int AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_MASK
public static final int AUDIO_FORMAT_HAS_PROPERTY_CHANNEL_INDEX_MASK
public static final Parcelable.Creator<AudioFormat> CREATOR
public static int inChannelMaskFromOutChannelMask(int outMask) throws IllegalArgumentException
outMask
- a combination of the CHANNEL_OUT_* definitions, but not CHANNEL_OUT_DEFAULTIllegalArgumentException
public static int channelCountFromInChannelMask(int mask)
mask
- a combination of the CHANNEL_IN_* definitions, even CHANNEL_IN_DEFAULTpublic static int channelCountFromOutChannelMask(int mask)
mask
- a combination of the CHANNEL_OUT_* definitions, but not CHANNEL_OUT_DEFAULTpublic static int convertChannelOutMaskToNativeMask(int javaMask)
mask
- a combination of the CHANNEL_OUT_* definitions, but not CHANNEL_OUT_DEFAULTpublic static int convertNativeChannelMaskToOutMask(int nativeMask)
mask
- a native channel maskpublic static int getBytesPerSample(int audioFormat)
public static boolean isValidEncoding(int audioFormat)
public static boolean isPublicEncoding(int audioFormat)
public static boolean isEncodingLinearPcm(int audioFormat)
public static boolean isEncodingLinearFrames(int audioFormat)
public static int[] filterPublicFormats(int[] formats)
public int getEncoding()
AudioFormat.Builder.setEncoding(int)
or
ENCODING_INVALID
if not set.public int getSampleRate()
AudioFormat.Builder.setSampleRate(int)
or
SAMPLE_RATE_UNSPECIFIED
if not set.public int getChannelMask()
getChannelIndexMask()
) and
the position-based mask returned by this function.AudioFormat.Builder.setChannelMask(int)
or
CHANNEL_INVALID
if not set.public int getChannelIndexMask()
getChannelMask()
).AudioFormat.Builder.setChannelIndexMask(int)
or
CHANNEL_INVALID
if not set or an invalid mask was used.public int getChannelCount()
public int getPropertySetMask()
public boolean equals(Object o)
Object
The equals
method implements an equivalence relation
on non-null object references:
x
, x.equals(x)
should return
true
.
x
and y
, x.equals(y)
should return true
if and only if
y.equals(x)
returns true
.
x
, y
, and z
, if
x.equals(y)
returns true
and
y.equals(z)
returns true
, then
x.equals(z)
should return true
.
x
and y
, multiple invocations of
x.equals(y)
consistently return true
or consistently return false
, provided no
information used in equals
comparisons on the
objects is modified.
x
,
x.equals(null)
should return false
.
The equals
method for class Object
implements
the most discriminating possible equivalence relation on objects;
that is, for any non-null reference values x
and
y
, this method returns true
if and only
if x
and y
refer to the same object
(x == y
has the value true
).
Note that it is generally necessary to override the hashCode
method whenever this method is overridden, so as to maintain the
general contract for the hashCode
method, which states
that equal objects must have equal hash codes.
equals
in class Object
o
- the reference object with which to compare.true
if this object is the same as the obj
argument; false
otherwise.Object.hashCode()
,
HashMap
public int hashCode()
Object
HashMap
.
The general contract of hashCode
is:
hashCode
method
must consistently return the same integer, provided no information
used in equals
comparisons on the object is modified.
This integer need not remain consistent from one execution of an
application to another execution of the same application.
equals(Object)
method, then calling the hashCode
method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode
method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hash tables.
As much as is reasonably practical, the hashCode method defined by
class Object
does return distinct integers for distinct
objects. (This is typically implemented by converting the internal
address of the object into an integer, but this implementation
technique is not required by the
JavaTM programming language.)
hashCode
in class Object
Object.equals(java.lang.Object)
,
System.identityHashCode(java.lang.Object)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
dest
- The Parcel in which the object should be written.flags
- Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE
.public String toString()
Object
toString
method returns a string that
"textually represents" this object. The result should
be a concise but informative representation that is easy for a
person to read.
It is recommended that all subclasses override this method.
The toString
method for class Object
returns a string consisting of the name of the class of which the
object is an instance, the at-sign character `@
', and
the unsigned hexadecimal representation of the hash code of the
object. In other words, this method returns a string equal to the
value of:
getClass().getName() + '@' + Integer.toHexString(hashCode())