Galera, não consigo executar a app. Aparece a mensagem "Agenda Keeps stopping"
ListaAlunosActivity:
ublic class ListaAlunosActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lista_alunos);
AlunoDAO dao = new AlunoDAO(this);
List<Aluno> alunos = dao.buscaAlunos();
dao.close(); // fechando a conexao com o banco
ListView listaAlunos = (ListView) findViewById(R.id.lista_alunos);
ArrayAdapter<Aluno> adapter = new ArrayAdapter<Aluno>(this, android.R.layout.simple_list_item_1, alunos);
listaAlunos.setAdapter(adapter);
Button novoAluno = (Button) findViewById(R.id.novo_aluno);
novoAluno.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent vaiParaOFormulario = new Intent(ListaAlunosActivity.this, FormularioActivity.class);
startActivity(vaiParaOFormulario);
}
});
}
}
FormularioActivity:
public class FormularioActivity extends AppCompatActivity {
private FormularioHelper helper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_formulario);
helper = new FormularioHelper(this);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_formulario, menu);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_formulario_ok:
Aluno aluno = helper.pegaAluno();
AlunoDAO alunoDAO = new AlunoDAO(this);
alunoDAO.insere(aluno);
alunoDAO.close(); //fechando a conexao com o banco
Toast.makeText(FormularioActivity.this, "Aluno " + aluno.getNome() +" salvo", Toast.LENGTH_SHORT).show();
finish();
break;
}
return super.onOptionsItemSelected(item);
}
}
```