They could tell me that I have bad. my method runs half

0

This is the method and only runs until the creation of myProducts the cursor and the rest does not. someone could tell me that I have bad thank you very much.

public List<Product> getProducts() throws SQLException
{
    String[] columns = new String[]{"_id","name","barcode","salePrice","numProvider","productImage"};

    Log.i(TAG,"Fetching the videos from the database for ListView");

    List<Product> myProducts = new ArrayList<Product>();
    Cursor c = ourDatabase.query(DatabaseContents.TABLE_PRODUCT_CATALOG.toString(),columns,null,null,null,null,null,null);
    Log.i(TAG,"Cursor created. Looping through rows");
    int prodIndex = c.getColumnIndex("_id");
    int prodIndexName = c.getColumnIndex("name");
    int prodIndexBarcode = c.getColumnIndex("barcode");
    int prodIndexSalePrice = c.getColumnIndex("salePrice");
    int prodIndexNumProvider= c.getColumnIndex("numProvider");
    int prodIndexProductImage = c.getColumnIndex("productImage");



    for (c.moveToFirst();!c.isAfterLast();c.moveToNext())
    {
        myProducts.add(new Product(c.getInt(prodIndex),c.getString(prodIndexName),
                c.getString(prodIndexBarcode),c.getDouble(prodIndexSalePrice),
                c.getInt(prodIndexNumProvider),c.getString(prodIndexProductImage)));

        Log.i(TAG,"Adding video name: "+ c.getString(prodIndex));
    }

    Log.i(TAG,"Finished adding items to videos class");
    return myProducts;

}
    
asked by MIke 26.03.2018 в 20:30
source

0 answers