Ao clicar em Visitar site, o browser não abre e da este erro:
E/InputEventReceiver: Exception dispatching input event. E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback E/MessageQueue-JNI: android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
Já chequei todo o código e não consegui encontrar nada de errado.
public void onCreateContextMenu(ContextMenu menu, View v, final ContextMenu.ContextMenuInfo menuInfo) { AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; final Aluno aluno = (Aluno) listaAlunos.getItemAtPosition(info.position);
MenuItem itemSite = menu.add("Visitar site"); Intent intentSite = new Intent(Intent.ACTION_VIEW);
String site = aluno.getSite(); if(!site.startsWith("http://")){ site = "http://"+site; } intentSite.setData(Uri.parse(site)); itemSite.setIntent(intentSite);
MenuItem deletar = menu.add("Deletar"); deletar.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem menuItem) {
AlunoDAO dao = new AlunoDAO(ListaAlunosActivity.this); dao.deleta(aluno); dao.close(); carregaLista();
return false; } }); }