C
computer_freak
Fortgeschrittenes Mitglied
- 7
Hallo,
Ich m;chte gerne eine Datei als Anhang einer Email, Bluetooth, etc versenden!
"selectedFile" ist vom Typ "File".
Hier mal mein Ansatz:
Der Fehler: Es kommt ein AlertDialog, der mir sagt, dass kein Service diesen Auftrag ausf[hren kann!
Ich m;chte gerne eine Datei als Anhang einer Email, Bluetooth, etc versenden!
"selectedFile" ist vom Typ "File".
Hier mal mein Ansatz:
Code:
Intent shareFile = new Intent(Intent.ACTION_SEND);
//Log.d("onContextItemSelected|mimeType", URLConnection.guessContentTypeFromName(selectedFile.getName()));
shareFile.setType(URLConnection.guessContentTypeFromName(selectedFile.getName()));
shareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse(selectedFile.getAbsolutePath()));
shareFile.putExtra(Intent.EXTRA_EMAIL, new String[] { });
shareFile.putExtra(Intent.EXTRA_SUBJECT, "Title");
shareFile.putExtra(Intent.EXTRA_TEXT, "Content");
//Log.v("onContextItemSelected|Uri=", Uri.parse("file://" + selectedFile.getAbsolutePath()).toString());
shareFile.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://" + selectedFile.getAbsolutePath()));
startActivity(Intent.createChooser(shareFile, getString(R.string.ctx_file_share)));
Der Fehler: Es kommt ein AlertDialog, der mir sagt, dass kein Service diesen Auftrag ausf[hren kann!