photo share intent in android -
intent shareintent = new intent(intent.action_send); shareintent.addflags(intent.flag_activity_clear_when_task_reset); shareintent.settype("image/*"); uri uri = uri.parse(pathtoimage); shareintent.putextra(intent.extra_stream, uri); return shareintent;
i used above code sharing image on social sites.when posting image on facebook text posted , image not coming.how can image , pathtoimage string variable getting sever image path , stored in string variable.but not working.please give solutions above question.?
try
bitmap icon = mbitmap; intent share = new intent(intent.action_send); share.settype("image/jpeg"); bytearrayoutputstream bytes = new bytearrayoutputstream(); icon.compress(bitmap.compressformat.jpeg, 100, bytes); file f = new file(environment.getexternalstoragedirectory() + file.separator + "temporary_file.jpg"); try { f.createnewfile(); fileoutputstream fo = new fileoutputstream(f); fo.write(bytes.tobytearray()); } catch (ioexception e) { e.printstacktrace(); } share.putextra(intent.extra_stream, uri.parse("file:///sdcard/temporary_file.jpg")); startactivity(intent.createchooser(share, "share image"));
refer more links
http://android-developers.blogspot.in/2012/02/share-with-intents.html
Comments
Post a Comment