android - How to share folders via intent? -
i have found code sharing image files via bluetooth/cloud storage/wifi. how share whole folder instead? here code-
private void shareimage() { intent share = new intent(intent.action_send); // if want share png image only, can do: // settype("image/png"); or jpeg: settype("image/jpeg"); share.settype("image/*"); // make sure put example png image named myimage.png in // directory string imagepath = environment.getexternalstoragedirectory() + "/myimage.png"; file imagefiletoshare = new file(imagepath); uri uri = uri.fromfile(imagefiletoshare); share.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(share, "share image!")); }
intent intent = new intent(); intent.setaction(intent.action_send_multiple); intent.putextra(intent.extra_subject, "here files."); intent.settype("*/*"); /* allow file type */ //get files in particular location file[] filestosend = new file("/sdcard/mydocs").listfiles(); arraylist<uri> files = new arraylist<uri>(); (file file : filestosend) { uri uri = uri.fromfile(file); files.add(uri); } intent.putparcelablearraylistextra(intent.extra_stream, files); startactivity(intent);
Comments
Post a Comment