我无法用数据库项填充 ListView。
sqlite中用于获取表的功能:
public Android.Database.ICursor getFornecedores()
{
Android.Database.ICursor temp = null;
try
{
sqlQuery = "SELECT * FROM Fornecedor;";
temp = sqlTemp.RawQuery(sqlQuery, null);
if (!(temp != null))
Console.WriteLine("Deu pau");
}
catch(SQLiteException e)
{
Console.WriteLine("Erro = " + e.Message);
}
return temp;
}
我尝试填充listView的功能:
public void loadListView()
{
Android.Database.ICursor fornecedores;
DataBaseHandler db = new DataBaseHandler();
fornecedores = db.getFornecedores();
SimpleCursorAdapter adapter;
cadastroListView.Adapter = new SimpleCursorAdapter(this, Android.Resource.Layout.SimpleDropDownItem1Line, fornecedores,
new string[] { "nome" }, new int[] { Android.Resource.Id.Text1 });
}
请帮帮我!谢谢!