Datei als Anhang senden

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:
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!
 

Ähnliche Themen

R
  • raller
Antworten
15
Aufrufe
505
DOT2010
DOT2010
S
Antworten
33
Aufrufe
2.540
Sempervivum
S
B
Antworten
4
Aufrufe
430
bb321
B
Zurück
Oben Unten