i want share image using action_send. when users taps on image , selects "share image" should send image selected, when testing, takes me app want use share i.e whatsapp, facebook, email etc. , when selecting either one, says "sharing failed, please try again." can't seem figure out why doesn't work. have same code display image file full screen action_view , seems work great not sharing.
public void onmulti2 (view view) { intent share = new intent(intent.action_send); share.settype("image/*"); string imagepath = environment.getexternalstoragedirectory() + "/ahmed.jpg"; file imagefiletoshare = new file(imagepath); uri uri = uri.fromfile(imagefiletoshare); share.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(share, "share image!")); }
set type image/jpg instead of image/*
public void onmulti2 (view view) { intent share = new intent(intent.action_send); share.settype("image/jpg"); string imagepath = environment.getexternalstoragedirectory() + "/ahmed.jpg"; file imagefiletoshare = new file(imagepath); uri uri = uri.fromfile(imagefiletoshare); share.putextra(intent.extra_stream, uri); startactivity(intent.createchooser(share, "share image!"));
}
Comments
Post a Comment