Package 

Class MatrixCursor

  • All Implemented Interfaces:
    android.database.Cursor , java.io.Closeable , java.lang.AutoCloseable

    
    public class MatrixCursor
    extends AbstractCursor
                        

    A mutable cursor implementation backed by an array of {@code Object}s. Use newRow to add rows. Automatically expands internal capacity as needed.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      public class MatrixCursor.RowBuilder

      Builds a row, starting from the left-most column and adding one columnvalue at a time. Follows the same ordering as the column names specifiedat cursor construction time.

    • Constructor Summary

      Constructors 
      Constructor Description
      MatrixCursor(Array<String> columnNames, int initialCapacity) Constructs a new cursor with the given initial capacity.
      MatrixCursor(Array<String> columnNames) Constructs a new cursor.
    • Method Summary

      Modifier and Type Method Description
      Array<String> getColumnNames()
      MatrixCursor.RowBuilder newRow() Adds a new row to the end and returns a builder for that row.
      void addRow(Array<Object> columnValues) Adds a new row to the end with the given column values.
      void addRow(Iterable<out Object> columnValues) Adds a new row to the end with the given column values.
      void fillWindow(int position, CursorWindow window)
      int getCount()
      String getString(int column)
      short getShort(int column)
      int getInt(int column)
      long getLong(int column)
      float getFloat(int column)
      double getDouble(int column)
      int getType(int column)
      boolean onMove(int oldPosition, int newPosition) This function is called every time the cursor is successfully scrolledto a new position, giving the subclass a chance to update any state itmay have.
      boolean isNull(int column)
      • Methods inherited from class net.zetetic.database.AbstractCursor

        close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getExtras, getNotificationUri, getPosition, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, unregisterContentObserver, unregisterDataSetObserver
      • Methods inherited from class android.database.Cursor

        close, copyStringToBuffer, deactivate, getBlob, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getColumnNames, getCount, getDouble, getExtras, getFloat, getInt, getLong, getNotificationUri, getNotificationUris, getPosition, getShort, getString, getType, getWantsAllOnMoveCalls, isAfterLast, isBeforeFirst, isClosed, isFirst, isLast, isNull, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, registerContentObserver, registerDataSetObserver, requery, respond, setExtras, setNotificationUri, setNotificationUris, unregisterContentObserver, unregisterDataSetObserver
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MatrixCursor

        MatrixCursor(Array<String> columnNames, int initialCapacity)
        Constructs a new cursor with the given initial capacity.
        Parameters:
        columnNames - names of the columns, the ordering of whichdetermines column ordering elsewhere in this cursor
        initialCapacity - in rows
      • MatrixCursor

        MatrixCursor(Array<String> columnNames)
        Constructs a new cursor.
        Parameters:
        columnNames - names of the columns, the ordering of whichdetermines column ordering elsewhere in this cursor
    • Method Detail

      • addRow

         void addRow(Array<Object> columnValues)

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

        Parameters:
        columnValues - in the same order as the the column names specifiedat cursor construction time
      • addRow

         void addRow(Iterable<out Object> columnValues)

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

        Parameters:
        columnValues - in the same order as the the column names specifiedat cursor construction time
      • getInt

         int getInt(int column)
      • getLong

         long getLong(int column)
      • onMove

         boolean onMove(int oldPosition, int newPosition)

        This function is called every time the cursor is successfully scrolledto a new position, giving the subclass a chance to update any state itmay have. If it returns false the move function will also do so and thecursor will scroll to the beforeFirst position.

        This function should be called by methods such as moveToPosition,so it will typically not be called from outside of the cursor class itself.

        Parameters:
        oldPosition - The position that we're moving from.
        newPosition - The position that we're moving to.
      • isNull

         boolean isNull(int column)