我引用了Facebook SDK3.0中的示例代码,使用WebDialog在我的墙上发布了故事。
示例代码演示了Bundle对象用于构造WebDialog.FeedDialogBuilder
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android");
params.putString("picture", "https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png");
所以我改变了一些词来测试我的项目:
Bundle params = new Bundle();
params.putString("name", "Push test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "");
但是WebDialog.FeedDialogBuilder上的“name”,“caption”,“description”的结果是 消失
然后我找到了params.putString("picture", "");
使用无效的URL或空字符串,WebDialog.FeedDialogBuilder将无效。
空字符串:
Bundle params = new Bundle();
params.putString("name", "Test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "");
包含无效的网址:
Bundle params = new Bundle();
params.putString("name", "Test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "null");
使用任何有效的网址:
Bundle params = new Bundle();
params.putString("name", "test");
params.putString("caption", "hello");
params.putString("description", "hello");
params.putString("link", "");
params.putString("picture", "http://www.technobuffalo.com/wp-content/uploads/2012/12/Google-Apps.jpeg");
只使用三个参数:
Bundle params = new Bundle();
params.putString("name", "test");
params.putString("caption", "hello");
params.putString("description", "hello");
那么,我应该如何将正确的值传递给params.putString("picture", "");
可以让它没有图片吗?
答案 0 :(得分:2)
实际问题是“链接”没有任何价值。
“name”,“caption”,“description”和“picture”都适用于链接字段。我不知道为什么当你有“图片”而不是“链接”的值时会显示任何内容,但我很确定问题是因为你没有“链接”。
答案 1 :(得分:0)
试试这个
Bundle params = new Bundle();
params.putString("name", "Facebook SDK for Android");
params.putString("caption", "Build great social apps and get more installs.");
params.putString("description", "The Facebook SDK for Android makes it easier and faster to develop Facebook integrated Android apps.");
params.putString("link", "https://developers.facebook.com/android"); // required filed
params.putString("picture", "");