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();
}
[url=viewtopic.php?t=14917]Ich möchte[/url] eine Taste implementieren, die beim Drücken des Standard -E -Mail -Clients mit einer Anhangsdatei geöffnet wird. Link?[code] 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();
}
[/code]