Facebook发布到墙上Android上,唯一的消息 [英] Facebook post to wall on Android, message only
本文介绍了Facebook发布到墙上Android上,唯一的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面code似乎只POST消息,别无其他。有我丢失的东西? (使用Facebook的Android SDK)
parameters.putString(链接的链接);
parameters.putString(说明,说明);
parameters.putString(标题,字幕);
parameters.putString(姓名,名);
parameters.putString(信息,味精);
尝试 {
字符串响应= mFacebook.request(ME /饲料,参数,POST);
}赶上(IOException异常E){
Log.e(错误,e.toString());
}
我收到很多的警告,但已经阅读这是正常的(也是,我得到的消息,但仍然帖子警告:
重点说明预计的byte [],但价值是java.lang.String。默认值小于;空>被退回。
尝试投产生的内部异常:
java.lang.ClassCastException:java.lang.String中
解决方案
检查我编辑的答案,它会发布在用户的墙上:
它会显示异常的情况下,但不要理会它,你的职位将是成功的。
公共无效postOnWall(){
尝试{
捆绑参数=新包();
parameters.putString(信息,文字是瘸子听好了:);
parameters.putString(姓名,姓名);
parameters.putString(链接,http://www.google.com);
parameters.putString(标题,标题);
parameters.putString(说明,说明);
字符串响应= facebook.request(ME /饲料,参数,POST);
Log.v(回应,回应);
}
赶上(例外五){}
}
The below code only seems to POST the 'message' and nothing else. Is there something I am missing? (using the Facebook Android SDK)
parameters.putString("link", link);
parameters.putString("description", description);
parameters.putString("caption", caption);
parameters.putString("name", name);
parameters.putString("message", msg);
try {
String response = mFacebook.request("me/feed", parameters, "POST");
} catch (IOException e) {
Log.e("Error", e.toString());
}
I am getting lots of warnings but have read this is normal (also, I am getting a warning for 'message' but that still posts:
Key caption expected byte[] but value was a java.lang.String. The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String
解决方案
Check my edited answer, it will post on the user's wall:
It will show the exception case, but don't bother about it, your post will be succeed.
public void postOnWall() {
try{
Bundle parameters = new Bundle();
parameters.putString("message", "Text is lame. Listen up:");
parameters.putString("name", "Name");
parameters.putString("link", "http://www.google.com");
parameters.putString("caption", "Caption");
parameters.putString("description", "Description");
String response = facebook.request("me/feed",parameters,"POST");
Log.v("response", response);
}
catch(Exception e){}
}
这篇关于Facebook发布到墙上Android上,唯一的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文