Example usage for android.database DatabaseUtils cursorStringToContentValues

List of usage examples for android.database DatabaseUtils cursorStringToContentValues

Introduction

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

Prototype

public static void cursorStringToContentValues(Cursor cursor, String field, ContentValues values, String key) 

Source Link

Document

Reads a String out of a field in a Cursor and writes it to a Map.

Usage

From source file:com.money.manager.ex.reports.PayeeReportFragment.java

private Payee getPayeeFromSelectedItem(ListView l, int position) {
    // Reading item from the list view, not adapter!
    Object item = l.getItemAtPosition(position);
    if (item == null)
        return null;

    Cursor cursor = (Cursor) item;
    Payee payee = new Payee();
    //        payee.loadFromCursor(cursor);
    // The fields are different! Can't use standard loadFromCursor.
    DatabaseUtils.cursorIntToContentValues(cursor, ViewMobileData.PAYEEID, payee.contentValues, Payee.PAYEEID);
    DatabaseUtils.cursorStringToContentValues(cursor, ViewMobileData.PAYEE, payee.contentValues,
            Payee.PAYEENAME);/*from   w  ww.j a  v  a 2s  .c o  m*/

    return payee;
}