@Override
public void onCreateContextMenu(ContextMenu menu, View v, final ContextMenu.ContextMenuInfo menuInfo) {
MenuItem deletar = menu.add("Deletar");
MenuItem limpar = menu.add("Limpar Todos");
deletar.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
Aluno aluno = (Aluno) listaAlunos.getItemAtPosition(info.position);
AlunoDao dao = new AlunoDao(ListaAlunosActivity.this);
dao.deleta(aluno);
dao.close();
return false;
}
});
}
public void deleta(Aluno aluno) {
SQLiteDatabase db = getWritableDatabase();
String [] params = {String.valueOf(aluno.getId())};
db.delete("Alunos", "id = ?", params);
}
como ficaria o :
public void limparTodos(){
}???