这是我想出的解决方案:如果您知道包名称,此功能允许您分享到 instagram、facebook 或任何其他应用程序。如果未安装该应用程序,它会重定向到 Play 商店。如果您将“其他”作为参数发送,您将显示一个也支持图像共享的应用程序列表。
shareImageIntent(mActivity,"image/*", "/storage/emulated/0/Pictures/Instagram/IMG_20150120_095603.jpg", "Instagram Sharing test. #Josh","com.instagram.android"); // parameters - for facebook: "com.facebook.katana" , to display list of other apps you can share to: "others"
 public void shareImageIntent(Activity a,String type, String mediaPath, String caption, String app){
        Intent intent = mContext.getPackageManager().getLaunchIntentForPackage(app);
        if ((intent != null)||(app.equals("others"))){
            // Create the new Intent using the 'Send' action.
            Intent share = new Intent(Intent.ACTION_SEND);
            if(!app.equals("others"))
                share.setPackage(app);
            // Set the MIME type
            share.setType(type);    
            // Create the URI from the media
            File media = new File(mediaPath);
            Uri uri = Uri.fromFile(media);
            // Add the URI and the caption to the Intent.
            share.putExtra(Intent.EXTRA_STREAM, uri);
            share.putExtra(Intent.EXTRA_TEXT, caption);
            // Broadcast the Intent.
            //startActivity(Intent.createChooser(share, "Share to"));
            a.startActivity(share);
            }
        else{
            intent = new Intent(Intent.ACTION_VIEW);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            //intent.setData(Uri.parse("market://details?id="+"com.instagram.android"));
            intent.setData(Uri.parse("market://details?id="+app));
            a.startActivity(intent);            
            }   
        }