Android APIs
public class

FieldPosition

extends Object
java.lang.Object
   ↳ java.text.FieldPosition

Class Overview

Identifies fields in formatted strings. If a FieldPosition is passed to the format method with such a parameter, then the indices will be set to the start and end indices of the field in the formatted string.

A FieldPosition can be created by using the integer constants in the various format classes (for example NumberFormat.INTEGER_FIELD) or one of the fields of type Format.Field.

If more than one field position is needed, the method formatToCharacterIterator(Object) should be used.

Summary

Public Constructors
FieldPosition(int field)
Constructs a new FieldPosition for the given field id.
FieldPosition(Format.Field attribute)
Constructs a new FieldPosition for the given Field attribute.
FieldPosition(Format.Field attribute, int field)
Constructs a new FieldPosition for the given Field attribute and field id.
Public Methods
boolean equals(Object object)
Compares the given object to this field position and indicates if they are equal.
int getBeginIndex()
Returns the index of the beginning of the field.
int getEndIndex()
Returns the index one past the end of the field.
int getField()
Returns the field which is being identified.
Format.Field getFieldAttribute()
Returns the attribute which is being identified.
int hashCode()
Returns an integer hash code for this object.
void setBeginIndex(int index)
Sets the index of the beginning of the field.
void setEndIndex(int index)
Sets the index of the end of the field.
String toString()
Returns the string representation of this field position.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public FieldPosition (int field)

Added in API level 1

Constructs a new FieldPosition for the given field id.

Parameters
field int

public FieldPosition (Format.Field attribute)

Added in API level 1

Constructs a new FieldPosition for the given Field attribute.

Parameters
attribute Format.Field

public FieldPosition (Format.Field attribute, int field)

Added in API level 1

Constructs a new FieldPosition for the given Field attribute and field id.

Parameters
attribute Format.Field
field int

Public Methods

public boolean equals (Object object)

Added in API level 1

Compares the given object to this field position and indicates if they are equal. In order to be equal, object must be an instance of FieldPosition with the same field, begin index and end index.

Parameters
object Object: the object to compare this instance with.
Returns
boolean true if the specified object is equal to this Object; false otherwise.

public int getBeginIndex ()

Added in API level 1

Returns the index of the beginning of the field.

Returns
int

public int getEndIndex ()

Added in API level 1

Returns the index one past the end of the field.

Returns
int

public int getField ()

Added in API level 1

Returns the field which is being identified.

Returns
int

public Format.Field getFieldAttribute ()

Added in API level 1

Returns the attribute which is being identified.

Returns
Format.Field

public int hashCode ()

Added in API level 1

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
int this object's hash code.

public void setBeginIndex (int index)

Added in API level 1

Sets the index of the beginning of the field.

Parameters
index int

public void setEndIndex (int index)

Added in API level 1

Sets the index of the end of the field.

Parameters
index int

public String toString ()

Added in API level 1

Returns the string representation of this field position.

Returns
String a printable representation of this object.