Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/192.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android facebook将多张图片上传到;“集团墙”;_Android_Facebook_Facebook Opengraph - Fatal编程技术网

android facebook将多张图片上传到;“集团墙”;

android facebook将多张图片上传到;“集团墙”;,android,facebook,facebook-opengraph,Android,Facebook,Facebook Opengraph,我正在开发一款具有社交功能的android应用程序。 我想有一个功能,他们可以上传多张照片到一个私人组内张贴 类似于此图像: 我对fb的OpenGraph和android api做了一些研究。我使用RequestBatch分离不同的图片,但facebook没有将它们合并到一篇帖子中。 我也使用WebDialog发布帖子,但我找不到让FeedDialog指向群组墙的方法。 我在谷歌上做了很多调查,但找不出任何可行的解决方案 如果有人知道如何做到这一点或给我一些例子,这将是非常感谢。提前谢谢 //

我正在开发一款具有社交功能的android应用程序。
我想有一个功能,他们可以上传多张照片到一个私人组内张贴

类似于此图像:

我对fb的OpenGraph和android api做了一些研究。我使用RequestBatch分离不同的图片,但facebook没有将它们合并到一篇帖子中。
我也使用WebDialog发布帖子,但我找不到让FeedDialog指向群组墙的方法。
我在谷歌上做了很多调查,但找不出任何可行的解决方案

如果有人知道如何做到这一点或给我一些例子,这将是非常感谢。提前谢谢

////////////////////第一种方式:发送批量请求到fb,我认为它会将它们合并到一个帖子中,但不是

ArrayList<String> list = new ArrayList();
list.add("http://example.url:8000/uploads/images1.jpg");
list.add("http://example.url:8000/uploads/images2.jpg");
list.add("http://example.url:8000/uploads/images3.jpg");
int index = 0;
RequestBatch reqBatch = new RequestBatch();
do {
    Bundle postParams = new Bundle();
    postParams.putString("picture", list.get(index).toString());
    postParams.putString("message", "message");
    Request request = new Request(Session.getActiveSession(),"group_id/feed", postParams, HttpMethod.POST);
    request.setCallback( new Request.Callback() {
        @Override
        public void onCompleted(Response response) {
            Log.d(TAG, ""+response);
        }
    });
    reqBatch.add(request);
    index++;
}while(list.size()>index);
reqBatch.executeAsync();

您可以与facebook应用程序共享多个图像

protected void share(String nameApp, String imagePath, String text) {
// TODO Auto-generated method stub 

try { 
    List<Intent> targetedShareIntents = new ArrayList<Intent>();
    Intent share = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
    share.setType("image/jpeg");
    List<ResolveInfo> resInfo = getActivity().getPackageManager()
            .queryIntentActivities(share, 0);
    if (!resInfo.isEmpty()) {
        for (ResolveInfo info : resInfo) {
            Intent targetedShare = new Intent(
                    android.content.Intent.ACTION_SEND_MULTIPLE);
            targetedShare.setType("image/png"); // put here your mime
            // type 
            if (info.activityInfo.packageName.toLowerCase().contains(
                    nameApp)
                    || info.activityInfo.name.toLowerCase().contains(
                            nameApp)) {
                targetedShare.putExtra(Intent.EXTRA_SUBJECT, text);
                targetedShare.putExtra(Intent.EXTRA_TEXT, text);
                ArrayList<Uri> files = new ArrayList<Uri>();
                for(int j= 0;j<caminhos.size();j++){
                    if(!caminhos.get(j).isEmpty()){
                        File file = new File(caminhos.get(j));
                        Uri uri = Uri.fromFile(file);
                        files.add(uri);
                    } 
                } 

                targetedShare.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
                        files);
                targetedShare.setPackage(info.activityInfo.packageName);
                targetedShareIntents.add(targetedShare);
            } 
        } 
        Intent chooserIntent = Intent.createChooser(
                targetedShareIntents.remove(0), "Select app to share");
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
                targetedShareIntents.toArray(new Parcelable[] {}));
        startActivity(chooserIntent);
    } 
} catch (Exception e) {
} 
}
受保护的无效共享(字符串nameApp、字符串imagePath、字符串文本){
//TODO自动生成的方法存根
试试{
List targetedShareContents=new ArrayList();
意向共享=新意向(android.content.Intent.ACTION\u SEND\u MULTIPLE);
share.setType(“图像/jpeg”);
List resInfo=getActivity().getPackageManager()
.查询活动(共享,0);
如果(!resInfo.isEmpty()){
对于(ResolveInfo:resInfo){
意向targetedShare=新意向(
android.content.Intent.ACTION\u SEND\u MULTIPLE);
targetedShare.setType(“image/png”);//将您的mime文件放在这里
//类型
如果(info.activityInfo.packageName.toLowerCase()包含(
名称(应用程序)
||info.activityInfo.name.toLowerCase()包含(
名称(应用程序)){
targetedShare.putExtra(Intent.EXTRA_主题,文本);
targetedShare.putExtra(Intent.EXTRA_TEXT,TEXT);
ArrayList files=新的ArrayList();
对于(int j=0;j
protected void share(String nameApp, String imagePath, String text) {
// TODO Auto-generated method stub 

try { 
    List<Intent> targetedShareIntents = new ArrayList<Intent>();
    Intent share = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
    share.setType("image/jpeg");
    List<ResolveInfo> resInfo = getActivity().getPackageManager()
            .queryIntentActivities(share, 0);
    if (!resInfo.isEmpty()) {
        for (ResolveInfo info : resInfo) {
            Intent targetedShare = new Intent(
                    android.content.Intent.ACTION_SEND_MULTIPLE);
            targetedShare.setType("image/png"); // put here your mime
            // type 
            if (info.activityInfo.packageName.toLowerCase().contains(
                    nameApp)
                    || info.activityInfo.name.toLowerCase().contains(
                            nameApp)) {
                targetedShare.putExtra(Intent.EXTRA_SUBJECT, text);
                targetedShare.putExtra(Intent.EXTRA_TEXT, text);
                ArrayList<Uri> files = new ArrayList<Uri>();
                for(int j= 0;j<caminhos.size();j++){
                    if(!caminhos.get(j).isEmpty()){
                        File file = new File(caminhos.get(j));
                        Uri uri = Uri.fromFile(file);
                        files.add(uri);
                    } 
                } 

                targetedShare.putParcelableArrayListExtra(Intent.EXTRA_STREAM,
                        files);
                targetedShare.setPackage(info.activityInfo.packageName);
                targetedShareIntents.add(targetedShare);
            } 
        } 
        Intent chooserIntent = Intent.createChooser(
                targetedShareIntents.remove(0), "Select app to share");
        chooserIntent.putExtra(Intent.EXTRA_INITIAL_INTENTS,
                targetedShareIntents.toArray(new Parcelable[] {}));
        startActivity(chooserIntent);
    } 
} catch (Exception e) {
} 
}