Continua o mesmo erro.
Tentei das duas formas, demonstrado na explicação
invocando explicitamente o método startActivity usando o setOnMenuItemClickListener:
MenuItem mapa = menu.add("Achar no Mapa");
mapa.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intentMapa = new Intent(Intent.ACTION_VIEW); intentMapa.setData(Uri.parse("geo:0,0?z=14&q="+alunoSelecionado.getEndereco()));
setIntent(intentMapa);
startActivity(intentMapa);
return false;
}
});
LogCat (explicitamente startActivity )
unfortunately
02-05 08:59:34.535: E/InputEventReceiver(1772): Exception dispatching input event.
02-05 08:59:34.545: E/MessageQueue-JNI(1772): Exception in MessageQueue callback: handleReceiveCallback
02-05 08:59:34.725: E/MessageQueue-JNI(1772): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=geo:0,0?z=14&q=Rua Aracati }
02-05 08:59:34.725: E/MessageQueue-JNI(1772): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
e diretamente
MenuItem mapa = menu.add("Achar no Mapa");
Intent intentMapa = new Intent(Intent.ACTION_VIEW); intentMapa.setData(Uri.parse("geo:0,0?z=14&q="+alunoSelecionado.getEndereco()));
mapa.setIntent(intentMapa);
LogCat: (método direto)
02-05 08:47:24.955: E/MenuItemImpl(1671): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=geo:0,0?z=14&q=Rua Aracati }
02-05 08:47:24.955: E/MenuItemImpl(1671): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1632)
outros que funcionam
MenuItem ligar = menu.add(0,0,0,"Ligar");
// Intent intentLigar = new Intent(Intent.ACTION_CALL);
Intent intentLigar = new Intent(Intent.ACTION_DIAL);
intentLigar.setData(Uri.parse("tel:"+alunoSelecionado.getTelefone()));
ligar.setIntent(intentLigar);
MenuItem SMS = menu.add("Enviar SMS");
Intent intentSMS = new Intent(Intent.ACTION_VIEW);
intentSMS.setData(Uri.parse("sms:"+alunoSelecionado.getTelefone()));
intentSMS.putExtra("sms_body"," Olá sou o Douglas Raphael, retornarei a ligação assim que possível");
SMS.setIntent(intentSMS);
MenuItem emailOP = menu.add(0,5,0, "Enviar E-mail ,...");
email.setOnMenuItemClickListener(new OnMenuItemClickListener() {
@Override
public boolean onMenuItemClick(MenuItem item) {
Intent intentEmail = new Intent(Intent.ACTION_SEND);
intentEmail.setType("message/rfc822");
intentEmail.putExtra(Intent.EXTRA_EMAIL,
new String[] { "caelum@caelum.com.br" });
intentEmail.putExtra(Intent.EXTRA_SUBJECT, "Elogios do curso de android");
intentEmail.putExtra(Intent.EXTRA_TEXT, "Este curso é ótimo!!!");
startActivity(Intent.createChooser(intentEmail, "Selecione a sua aplicação de email!"));
return false;
}
});