android - Why is my share function only working with whatsapp? -


i have full screen activity:

    public class fullimageactivity extends activity {        @override     public void oncreate(bundle savedinstancestate) {         super.oncreate(savedinstancestate);         setcontentview(r.layout.full_image);          // intent data         intent = getintent();          // selected image id         int position = i.getextras().getint("id");         imageadapter imageadapter = new imageadapter(this);          imageview imageview = (imageview) findviewbyid(r.id.full_image_view);         imageview.setimageresource(imageadapter.mthumbids[position]);         bitmapdrawable bm = (bitmapdrawable) imageview.getdrawable();         bitmap mysharebmp = bm.getbitmap();           try {             bytearrayoutputstream bytes = new bytearrayoutputstream();             mysharebmp.compress(bitmap.compressformat.jpeg, 100, bytes);              //you can create new file name "test.jpeg"             file f = new file(environment.getexternalstoragepublicdirectory(environment.directory_pictures)                                     + file.separator + "test.jpeg");              f.createnewfile();             //write bytes in file             fileoutputstream fo = new fileoutputstream(f);             fo.write(bytes.tobytearray());              // remember close de fileoutput             fo.close();           log.d("done","done");         } catch (filenotfoundexception e) {           e.printstacktrace();         } catch (ioexception e) {           e.printstacktrace();         }           string path = environment.getexternalstoragepublicdirectory(environment.directory_pictures) + file.separator + "test.jpeg";         uri m = uri.parse(path);         intent sharingintent = new intent(intent.action_send);           sharingintent.settype("image/*");         sharingintent.putextra(intent.extra_stream, m);         startactivity(intent.createchooser(sharingintent,                             "share image using"));       }   } 

why whatsapp app working? other apps telling failed or unable download.... share every app , don´t know i´m doing wrong plz me bet it´s easy you.

thx dudes!

closed found solution

sharingintent.putextra(intent.extra_stream, uri.parse("file:///mnt/sdcard/pictures/tmp.jpeg")); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -