Android 如何获取Facebook JSON回复链接?
我想获取我的状态,从我打开我的应用程序的那一天开始到以后的几天。但我很难理解Facebook页面上的例子。我无法想象GraphRequest的响应是什么,我应该编写什么代码来获取这些状态Android 如何获取Facebook JSON回复链接?,android,facebook,Android,Facebook,我想获取我的状态,从我打开我的应用程序的那一天开始到以后的几天。但我很难理解Facebook页面上的例子。我无法想象GraphRequest的响应是什么,我应该编写什么代码来获取这些状态 new GraphRequest( AccessToken.getCurrentAccessToken(), "/{status-id}", null, HttpMethod.GET, new GraphRequest.Callback() { publi
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/{status-id}",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
/* handle the result */
}
}
).executeAsync();
我想要一个像这样的回复链接来知道我应该做什么
希望这能帮助某人:
new GraphRequest(AccessToken.getCurrentAccessToken(),
"/me/posts", null, HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(
GraphResponse response) {
/* handle the result */
JSONObject json = response
.getJSONObject();
JSONArray arr;
try {
arr = json.getJSONArray("data");
for (int i = 0; i < 3; i++) {
JSONObject json_obj = arr
.getJSONObject(i);
String id = json_obj
.getString("id");
String message = json_obj
.getString("message");
String picture = json_obj
.getString("picture");
String created_time = json_obj
.getString("created_time");
String test = String
.valueOf(json_obj);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}).executeAsync();
new GraphRequest(AccessToken.getCurrentAccessToken(),
“/me/posts”,null,HttpMethod.GET,
新建GraphRequest.Callback(){
公共空间未完成(
GraphResponse(反应){
/*处理结果*/
JSONObject json=响应
.getJSONObject();
JSONArray arr;
试一试{
arr=json.getJSONArray(“数据”);
对于(int i=0;i<3;i++){
JSONObject json_obj=arr
.getJSONObject(i);
字符串id=json_obj
.getString(“id”);
String message=json_obj
.getString(“消息”);
字符串picture=json_obj
.getString(“图片”);
创建的字符串\u time=json\u obj
.getString(“创建时间”);
字符串测试=字符串
.valueOf(json_obj);
}
}捕获(JSONException e){
//TODO自动生成的捕捉块
e、 printStackTrace();
}
}
}).executeAsync();
你为什么要举一个有关Instagram的API调用示例,并谈论Facebook?我的意思是我想得到这样的JSON,但没关系,我找到了一个解决方案;)