Example usage for android.database MatrixCursor MatrixCursor

List of usage examples for android.database MatrixCursor MatrixCursor

Introduction

In this page you can find the example usage for android.database MatrixCursor MatrixCursor.

Prototype

public MatrixCursor(String[] columnNames) 

Source Link

Document

Constructs a new cursor.

Usage

From source file:de.nware.app.hsDroid.provider.onlineService2Provider.java

/**
 * Parses the exam info./*  w w  w . j a v a2  s .  co  m*/
 * 
 * @param htmlContentString
 *            der/die/das html content string
 * @return der/die/das cursor
 * @throws SAXException
 */
private Cursor parseExamInfo(String htmlContentString) throws SAXException {
    final MatrixCursor cursor = new MatrixCursor(EXAM_INFOS_COLUMNS);
    try {
        ExamInfoParser handler = new ExamInfoParser();
        System.out.println("content exam info: " + htmlContentString);
        Xml.parse(htmlContentString, handler);
        ExamInfo exInfos = handler.getExamInfos();
        cursor.addRow(new Object[] { 0, exInfos.getSehrGutAmount(), exInfos.getGutAmount(),
                exInfos.getBefriedigendAmount(), exInfos.getAusreichendAmount(),
                exInfos.getNichtAusreichendAmount(), exInfos.getAttendees(), exInfos.getAverage() });
    } catch (SAXException e) {
        Log.e("read:SAXException:", e.getMessage());
        e.printStackTrace();
        throw new SAXException(e);
    }
    return cursor;
}

From source file:de.nware.app.hsDroid.provider.onlineService2Provider.java

/**
 * Gibt certifications./*w w w  .j a  v a2 s. c o m*/
 * 
 * @return Der/Die/das certifications
 */
private Cursor getCertifications() {

    final MatrixCursor cursor = new MatrixCursor(CERTIFICATIONS_COLUMNS);
    int count = 0;
    for (String certType : certificationType2) {
        String downloadUrl = String.format(certificationURLTmpl2, urlBase, certType, StaticSessionData.asiKey);
        cursor.addRow(new Object[] { count, certificationName[count], downloadUrl });
        count++;
    }

    return cursor;

}

From source file:com.facebook.samples.booleanog.LogicActivity.java

private MatrixCursor createEmptyCursor() {
    String[] cursorColumns = { "_ID", "date", "action" };
    return new MatrixCursor(cursorColumns);
}

From source file:de.vanita5.twittnuker.provider.TwidereDataProvider.java

private Cursor getCachedImageCursor(final String url) {
    if (Utils.isDebugBuild()) {
        Log.d(LOGTAG, String.format("getCachedImageCursor(%s)", url));
    }/*from   w  ww.  j a  v a 2 s .c  om*/
    final MatrixCursor c = new MatrixCursor(TwidereDataStore.CachedImages.MATRIX_COLUMNS);
    final File file = mImagePreloader.getCachedImageFile(url);
    if (url != null && file != null) {
        c.addRow(new String[] { url, file.getPath() });
    }
    return c;
}

From source file:com.esri.android.mapsapp.MapFragment.java

/**
 * Initialize Suggestion Cursor//  w w w.  j a va 2s  . c  o m
 */
private void initSuggestionCursor() {
    String[] cols = new String[] { BaseColumns._ID, COLUMN_NAME_ADDRESS, COLUMN_NAME_X, COLUMN_NAME_Y };
    mSuggestionCursor = new MatrixCursor(cols);
}

From source file:de.vanita5.twittnuker.provider.TwidereDataProvider.java

private Cursor getDNSCursor(final String host) {
    final MatrixCursor c = new MatrixCursor(TwidereDataStore.DNS.MATRIX_COLUMNS);
    try {/* w  w  w .  jav a2  s. c  o  m*/
        final String address = mHostAddressResolver.resolve(host);
        if (host != null && address != null) {
            c.addRow(new String[] { host, address });
        }
    } catch (final IOException e) {

    }
    return c;
}

From source file:com.csipsimple.db.DBProvider.java

/**
 * Build a {@link Cursor} with a single row that contains all values
 * provided through the given {@link ContentValues}.
 *///from w w w.  j a v  a 2s. c  o m
private Cursor getCursor(ContentValues[] contentValues) {
    if (contentValues.length > 0) {
        final Set<Entry<String, Object>> valueSet = contentValues[0].valueSet();
        int colSize = valueSet.size();
        final String[] keys = new String[colSize];

        int i = 0;
        for (Entry<String, Object> entry : valueSet) {
            keys[i] = entry.getKey();
            i++;
        }

        final MatrixCursor cursor = new MatrixCursor(keys);
        for (ContentValues cv : contentValues) {
            final Object[] values = new Object[colSize];
            i = 0;
            for (Entry<String, Object> entry : cv.valueSet()) {
                values[i] = entry.getValue();
                i++;
            }
            cursor.addRow(values);
        }
        return cursor;
    }
    return null;
}

From source file:de.vanita5.twittnuker.provider.TwidereDataProvider.java

private Cursor getNotificationsCursor() {
    final MatrixCursor c = new MatrixCursor(TwidereDataStore.Notifications.MATRIX_COLUMNS);
    c.addRow(new Integer[] { NOTIFICATION_ID_HOME_TIMELINE, mUnreadStatuses.size() });
    c.addRow(new Integer[] { NOTIFICATION_ID_MENTIONS_TIMELINE, mNewMentions.size() });
    c.addRow(new Integer[] { NOTIFICATION_ID_DIRECT_MESSAGES, mNewMessages.size() });
    return c;//from w  w  w .j a v  a2s  .  com
}

From source file:org.getlantern.firetweet.provider.FiretweetDataProvider.java

private Cursor getCachedImageCursor(final String url) {
    if (Utils.isDebugBuild()) {
        Log.d(LOGTAG, String.format("getCachedImageCursor(%s)", url));
    }//from   ww w . j  av a2  s.c  om
    final MatrixCursor c = new MatrixCursor(FiretweetDataStore.CachedImages.MATRIX_COLUMNS);
    final File file = mImagePreloader.getCachedImageFile(url);
    if (url != null && file != null) {
        c.addRow(new String[] { url, file.getPath() });
    }
    return c;
}

From source file:de.vanita5.twittnuker.provider.TwidereDataProvider.java

private Cursor getNotificationsCursor(final int id) {
    final MatrixCursor c = new MatrixCursor(TwidereDataStore.Notifications.MATRIX_COLUMNS);
    if (id == NOTIFICATION_ID_HOME_TIMELINE) {
        c.addRow(new Integer[] { id, mNewStatuses.size() });
    } else if (id == NOTIFICATION_ID_MENTIONS_TIMELINE) {
        c.addRow(new Integer[] { id, mNewMentions.size() });
    } else if (id == NOTIFICATION_ID_DIRECT_MESSAGES) {
        c.addRow(new Integer[] { id, mNewMessages.size() });
    }//from  ww  w .  ja v a2 s  .  c o m
    return c;
}