分享文字和图片一起使用Facebook的SDK中的Andr​​oid [英] Share text and Image together using Facebook SDK in Android

查看:100
本文介绍了分享文字和图片一起使用Facebook的SDK中的Andr​​oid的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Facebook的SDK中Android.I份额文字和图片使用了以下code及其工作共享文本,但如何共享图像together.I'm所以困惑this.If任何了解的请给我建议。

I'm using facebook SDK for share text and image in Android.I have used following code and its working for share text but how to share image together.I'm so confused about this.If any know please suggest me.

code:

public class MainActivity extends Activity {

Facebook facebook = new Facebook("App ID");
EditText edittext;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    edittext = (EditText) findViewById(R.id.revieew);

    facebook.authorize(this, new DialogListener() {
        @Override
        public void onComplete(Bundle values) {
        }

        @Override
        public void onFacebookError(FacebookError error) {
        }

        @Override
        public void onError(DialogError e) {
        }

        @Override
        public void onCancel() {
        }
    });
}

public void share(View v) {
    //facebook.dialog(this, "feed", new PostDialogListener());

    Bundle parameters = new Bundle();
    // parameters.putString("message", category_item_name_desc.getText()
    // .toString());
    // parameters.putString("picture", categoryItemsModel.getImageUrl());
    parameters.putString("caption", edittext.getText().toString());
    try {
        facebook.request("/me/feed", parameters, "POST");
        System.out
                .println("**********************POST**********************************");
    } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    facebook.authorizeCallback(requestCode, resultCode, data);
}

} ,也是我不想显示的份额图片和文字我想使用EDITTEXT和按键该对话框...

} And also i don't want to show dialog for share image and text i want to use Edittext and button for that...

推荐答案

嘿,这code可能会有所帮助,

Hey this code might be helpful,

Bundle parameters = new Bundle();
                parameters.putString("message", category_item_name_desc.getText().toString());
                parameters.putString("picture", categoryItemsModel.getImageUrl());
                parameters.putString("caption", txtDescription_desc.getText().toString());
                facebook.request("/me/feed", parameters, "POST");

您可以通过添加paramater为标题

You can add text by adding paramater as "caption"

这篇关于分享文字和图片一起使用Facebook的SDK中的Andr​​oid的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆