Ich versuche, das Bild geklickt durch meine Anwendung als Anhang per E-Mail senden. Das Bild ist angeklickt und ich bekomme den Pfad korrekt, aber die Anwendung wirft mir eine Laufzeit Ausnahme. "Keine Aktivität gefunden, um Intent zu behandeln". Ich teste das auf meinem Gerät und ich habe mein Google Mail-Konto konfiguriert. Ich bin mir nicht sicher, wie ich das lösen soll. Bitte helfen Sie.Keine Aktivität gefunden Absicht beim Senden von E-Mails zu behandeln
Dies ist mein Code:
public static void sendEmail(Context context, String[] recipientList, String title, String subject, String body) {
Intent intent = new Intent(Intent.ACTION_SENDTO, Uri.parse("mailto:[email protected]"));
intent.setType("plain/text");
intent.putExtra(android.content.Intent.EXTRA_EMAIL, recipientList);
intent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
intent.putExtra(android.content.Intent.EXTRA_TEXT, body);
intent.putExtra(Intent.EXTRA_STREAM, capturedImageFilePath);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
Und das ist das Protokoll:
01-15 11:26:04.455: E/AndroidRuntime(9904): FATAL EXCEPTION: main
01-15 11:26:04.455: E/AndroidRuntime(9904): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.SENDTO typ=plain/text flg=0x10000000 (has extras) }
01-15 11:26:04.455: E/AndroidRuntime(9904): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1512)
01-15 11:26:04.455: E/AndroidRuntime(9904): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1384)
01-15 11:26:04.455: E/AndroidRuntime(9904): at android.app.ContextImpl.startActivity(ContextImpl.java:852)
01-15 11:26:04.455: E/AndroidRuntime(9904): at android.content.ContextWrapper.startActivity(ContextWrapper.java:276)
01-15 11:26:04.455: E/AndroidRuntime(9904): at com.example.attachmail.AttchmentActivity.sendEmail(AttchmentActivity.java:133)
01-15 11:26:04.455: E/AndroidRuntime(9904): at com.example.attachmail.AttchmentActivity$2.onClick(AttchmentActivity.java:93)
Versuchen Sie, das Flag "Intent.FLAG_DEBUG_LOG_RESOLUTION" hinzuzufügen. Es könnte Ihnen helfen, es herauszufinden. – kichik
Versucht Intent.FLAG_DEBUG_LOG_RESOLUTION wirft mir die folgende Ausnahme :: Aufruf von startActivity() von außerhalb eines Aktivitätskontexts erfordert das Flag FLAG_ACTIVITY_NEW_TASK. Ist das wirklich was du willst? – Nisha