Android: how to override ContentProvider's ParcelFileDescriptor openFile method to send file from url as attachment via email? -
i've searched lot did not stumble upon have do. when click send email file shown attached never receive attached file there special way send attachments receive url? here activity code: http://pastebin.com/uzdjyxab[2] , here project https://docs.google.com/file/d/0b-91m-6zevwcrtytyxrgb3l6uve/edit?usp=sharing code "send email" button: sendemail_button.setonclicklistener(new onclicklistener() {
@override public void onclick(view v) { // todo auto-generated method stub intent intent = new intent(intent.action_send_multiple); intent.settype("*/*"); intent.putextra(intent.extra_subject, "attachment app"); intent.putextra(intent.extra_text, "sending mp3 file " + title); intent.putextra(intent.extra_email, new string[] {"some_email@email.com"}); arraylist<uri> uris = new arraylist<uri>(); uris.add(uri.fromfile(new file(trackurl))); intent.putparcelablearraylistextra(intent.extra_stream, uris); startactivity(intent.createchooser(intent, "send mail")); } });
maybe there has other way put audio file url intent? have use intent.putparcelablearraylistextra(intent.extra_stream, uri); part of task. skipped part
action_send_multiple use external activity should access sound file. allow such access need: - create contentprovider. - override public parcelfiledescriptor openfile(uri uri, string mode)
does mean use of content provider can , put file url email attachment? googled did not find how correctly override public parcelfiledescriptor openfile(uri uri, string mode), maybe @ least point me in right direction? again i'm not asking solve this, @ least point me out mistakes , give advise.
you don't need content provider if files in public directory. in way :
private void launchshareactivity(final list<string> exported_filenames) { log.v(debug_tag, "launchshareactivity"); final intent intent = new intent(intent.action_send_multiple); intent.settype("*/*"); if (exported_filenames.size() == 0) { log.i(debug_tag, "there no file share"); return; } final arraylist<uri> uris = new arraylist<uri>(); (final string exported_file : exported_filenames) { final file f = new file(exported_file); uris.add(uri.fromfile(f)); } intent.putparcelablearraylistextra(intent.extra_stream, uris); activity.startactivity(intent.createchooser(intent, "send page")); }
Comments
Post a Comment