MyTetra Share
Делитесь знаниями!
CrimeCursorWrapper.java
29.04.2017
15:58
Раздел: Android - books - AndroidProgramming2e - 14 Базы данных SQLite
CrimeCursorWrapper.java

CrimeCursorWrapper.java

package com.bignerdranch.android.criminalintent.database; 
 
import android.database.Cursor; 
import android.database.CursorWrapper; 
 
import com.bignerdranch.android.criminalintent.Crime; 
 
import java.util.Date; 
import java.util.UUID; 
 
import com.bignerdranch.android.criminalintent.database.CrimeDbSchema.CrimeTable; 
 
public class CrimeCursorWrapper extends CursorWrapper { 
    public CrimeCursorWrapper(Cursor cursor) { 
        super(cursor); 
    } 
 
    public Crime getCrime() { 
        String uuidString = getString(getColumnIndex(CrimeTable.Cols.UUID)); 
        String title = getString(getColumnIndex(CrimeTable.Cols.TITLE)); 
        long date = getLong(getColumnIndex(CrimeTable.Cols.DATE)); 
        int isSolved = getInt(getColumnIndex(CrimeTable.Cols.SOLVED)); 
 
        Crime crime = new Crime(UUID.fromString(uuidString)); 
        crime.setTitle(title); 
        crime.setDate(new Date(date)); 
        crime.setSolved(isSolved != 0); 
 
        return crime; 
    } 
} 

 
MyTetra Share v.0.52
Яндекс индекс цитирования