Senden einer E -Mail mit Anhängen programmgesteuert auf Android

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Senden einer E -Mail mit Anhängen programmgesteuert auf Android

by Anonymous » 03 Jun 2025, 09:06

Ich möchte eine Taste implementieren, die beim Drücken des Standard -E -Mail -Clients mit einer Anhangsdatei geöffnet wird. Link?

Code: Select all

    public void sendFileToEmail(File f){

String subject = "Lap times";
ArrayList attachments = new ArrayList();
attachments.add(Uri.fromFile(f));
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
intent.setClassName("com.android.email", "com.android.mail.compose.ComposeActivity");

try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}

Top