Android
android.database
public class

android.database.MatrixCursor

java.lang.Object
android.database.AbstractCursor CrossProcessCursor
android.database.MatrixCursor

A mutable cursor implementation backed by an array of Objects. Use newRow() to add rows. Automatically expands internal capacity as needed.

Nested Classes
MatrixCursor.RowBuilder Builds a row, starting from the left-most column and adding one column value at a time. 

Summary

Fields inherited from class android.database.AbstractCursor

Public Constructors

            MatrixCursor(String[] columnNames, int initialCapacity)
Constructs a new cursor with the given initial capacity.
            MatrixCursor(String[] columnNames)
Constructs a new cursor.

Public Methods

          void  addRow(Object[] columnValues)
Adds a new row to the end with the given column values.
          void  addRow(Iterable<?> columnValues)
Adds a new row to the end with the given column values.
          String[]  getColumnNames()
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.
          int  getCount()
Returns the numbers of rows in the cursor.
          double  getDouble(int column)
Returns the value of the requested column as a double.
          float  getFloat(int column)
Returns the value of the requested column as a float.
          int  getInt(int column)
Returns the value of the requested column as an int.
          long  getLong(int column)
Returns the value of the requested column as a long.
          short  getShort(int column)
Returns the value of the requested column as a short.
          String  getString(int column)
Returns the value of the requested column as a String.
          boolean  isNull(int column)
Returns true if the value in the indicated column is null.
          MatrixCursor.RowBuilder  newRow()
Adds a new row to the end and returns a builder for that row.
Methods inherited from class android.database.AbstractCursor
Methods inherited from class java.lang.Object
Methods inherited from interface android.database.CrossProcessCursor
Methods inherited from interface android.database.Cursor

Details

Public Constructors

public MatrixCursor(String[] columnNames, int initialCapacity)

Constructs a new cursor with the given initial capacity.

Parameters

columnNames names of the columns, the ordering of which determines column ordering elsewhere in this cursor
initialCapacity in rows

public MatrixCursor(String[] columnNames)

Constructs a new cursor.

Parameters

columnNames names of the columns, the ordering of which determines column ordering elsewhere in this cursor

Public Methods

public void addRow(Object[] columnValues)

Adds a new row to the end with the given column values. Not safe for concurrent use.

Parameters

columnValues in the same order as the the column names specified at cursor construction time

Throws

IllegalArgumentException if columnValues.length != columnNames.length

public void addRow(Iterable<?> columnValues)

Adds a new row to the end with the given column values. Not safe for concurrent use.

Parameters

columnValues in the same order as the the column names specified at cursor construction time

Throws

IllegalArgumentException if columnValues.size() != columnNames.length

public String[] getColumnNames()

Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.

public int getCount()

Returns the numbers of rows in the cursor.

public double getDouble(int column)

Returns the value of the requested column as a double.

If the native content of that column is not numeric the result will be the result of passing the column value to Double.valueOf(x).

public float getFloat(int column)

Returns the value of the requested column as a float.

If the native content of that column is not numeric the result will be the result of passing the column value to Float.valueOf(x).

public int getInt(int column)

Returns the value of the requested column as an int.

If the native content of that column is not numeric the result will be the result of passing the column value to Integer.valueOf(x).

public long getLong(int column)

Returns the value of the requested column as a long.

If the native content of that column is not numeric the result will be the result of passing the column value to Long.valueOf(x).

public short getShort(int column)

Returns the value of the requested column as a short.

If the native content of that column is not numeric the result will be the result of passing the column value to Short.valueOf(x).

public String getString(int column)

Returns the value of the requested column as a String.

If the native content of that column is not text the result will be the result of passing the column value to String.valueOf(x).

public boolean isNull(int column)

Returns true if the value in the indicated column is null.

public MatrixCursor.RowBuilder newRow()

Adds a new row to the end and returns a builder for that row. Not safe for concurrent use.

Returns

  • builder which can be used to set the column values for the new row
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48