共享图像不工作在Viber和Facebook

我使用下面的代码共享图像,但不幸的是,它只适用于线 ,而不是FacebookViber

码:

Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("image/png"); share.putExtra(Intent.EXTRA_STREAM, Uri.parse(G.DIR_APP + "/sample_image.png")); startActivity(Intent.createChooser(share, "Share image")); 

Solutions Collecting From Web of "共享图像不工作在Viber和Facebook"

直接分享到Facebook和Viber …

 Intent share = new Intent(android.content.Intent.ACTION_SEND); share.setType("image/png"); share.setPackage("com.facebook.katana"); //for viber package is "com.viber.voip". share.putExtra(Intent.EXTRA_STREAM, ImageUri); startActivity(p_intent.createChooser(share, "Share With"));