Lines Matching defs:cursor

34      * Returns a cursor with a subset of the rows passed into this function. If {@param number}
35 * starts with a "*" then only rows from {@param cursor} that have a number equal to
37 * only rows from {@param cursor} that have numbers without starting "*" characters
43 * @param cursor this function takes ownership of the cursor. The calling scope MUST NOT
44 * use or close() the cursor passed into this function. The cursor must contain
47 * @return a cursor that the calling context owns
49 public static Cursor removeNonStarMatchesFromCursor(String number, Cursor cursor) {
52 Cursor unreturnedCursor = cursor;
57 return cursor;
62 && !matchingNumberStartsWithStar(cursor)) {
63 cursor.moveToPosition(-1);
65 return cursor;
68 final MatrixCursor matrixCursor = new MatrixCursor(cursor.getColumnNames());
74 cursor.moveToPosition(-1);
75 while (cursor.moveToNext()) {
76 final int numberIndex = cursor.getColumnIndex(PhoneLookup.NUMBER);
78 = normalizeNumberWithStar(cursor.getString(numberIndex));
82 // Copy row from cursor into matrixCursor
84 for (int column = 0; column < cursor.getColumnCount(); column++) {
85 b.add(cursor.getColumnName(column), cursorValue(cursor, column));
120 * @return whether {@param cursor} contain any numbers that start with "*"
122 private static boolean matchingNumberStartsWithStar(Cursor cursor) {
123 cursor.moveToPosition(-1);
124 while (cursor.moveToNext()) {
125 final int numberIndex = cursor.getColumnIndex(PhoneLookup.NUMBER);
126 final String phoneNumber = normalizeNumberWithStar(cursor.getString(numberIndex));
134 private static Object cursorValue(Cursor cursor, int column) {
135 switch(cursor.getType(column)) {
137 return cursor.getBlob(column);
139 return cursor.getInt(column);
141 return cursor.getFloat(column);
143 return cursor.getString(column);
147 Log.d(TAG, "Invalid value in cursor: " + cursor.getType(column));