Está dando esse erro:
08-30 22:37:32.683: E/Cursor(278): Finalizing a Cursor that has not been deactivated or closed. database = /data/data/com.br.aquavendas/databases/aqua, table = clientes, query = SELECT * FROM clientes WHERE _id=6
Não estou identificando onde tenho que fechar esse Cursor.
Chamo a Lista da classe Vendas
Clientes = (Button) findViewById(R.id.btnClientes);
Clientes.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(Vendas.this, Lista.class);
intent.putExtra("itemMenu", "2 - Listar Clientes");
startActivity(intent);
}
});
Esse trecho é o que carrega o listview com clientes, está na classe Lista.
// Lista todos os clientes
private void carregaListaCliente(){
Cursor cursor;
db.open();
cursor = db.getTodosClientes();
cursor.moveToFirst();
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.mostrabanco, cursor, new String[] {DbAdapter.KEY_RAZAOSOCIALNOME, DbAdapter.KEY_CELULAR, DbAdapter.KEY_EMAIL}, new int[] {R.id.lblCampo1,R.id.lblCampo2,R.id.lblCampo3});
//SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.two_line_list_item, cursor, new String[] {DbAdapter.KEY_NOME, DbAdapter.KEY_CELULAR}, new int[] {android.R.id.text1, android.R.id.text2});
setListAdapter(adapter);
db.close();
}