Code example for CursorLoader

Methods: getContext

0
    public static final String TAG = VehicleCursorLoader.class.getSimpleName();
 
    private VehicleRepository repository;
 
    public VehicleCursorLoader(Context context) {
        super(context);
        repository = new VehicleRepository(getContext());
    } 
 
    @Override 
    public Cursor loadInBackground() {
        Cursor cursor =  repository.findAll();
        if (cursor != null) {
            // Ensure the cursor window is filled 
            int count = cursor.getCount();
            Log.v(TAG, "count = " + count);
        } 
        return cursor;
    }