我试图从图表中获取用户和他的朋友的分数,但我遇到了错误。“只有创建视图层次结构的原始线程才能触及它的视图。” 执行时。
JSONArray responseJSONArray = new JSONArray(response);
我拥有所需的所有权限。我通过使用以下方法成功将分数发布到图表中:
fbParams.putString("score", "" + 555);
Request postScoreRequest = new Request(Session.getActiveSession(),
"me/scores",
fbParams,
HttpMethod.POST,
new Request.Callback() {
...
...
当我试图得到分数时。即使从使用这种模式的浏览器
https://graph.facebook.com/{userid}/scores?access_token={app_access_token}
我有
{"data":[{"user":{"name":"MYUSERNAME","id":"MIID"},"score":555,"application":{"name":"Tomato Smasher","namespace":"tomatosmasher","id":"354552234651550"}}]}
我从以下网址获得了访问代码: https ://developers.facebook.com/tools/explorer
但在 android 应用程序中使用:
Session.getActiveSession().getAccessToken();
// Execute the HTTP Get to our server for the scores of the user's friends
HttpClient client = new DefaultHttpClient();
String getURL = "https://graph.facebook.com/" + currentUserFBID + "/scores?access_token=" + currentUserAccessToken;
HttpGet get = new HttpGet(getURL);
HttpResponse responseGet = client.execute(get);
System.out.println("ALL GOOD2");
// Parse the response
HttpEntity responseEntity = responseGet.getEntity();
String response = EntityUtils.toString(responseEntity);
System.out.println("ALL GOOD3");
if (!response.equals(null)) {
System.out.println("ALL GOOD4");
System.out.println(response);
JSONArray responseJSONArray = new JSONArray(response); // <----------------got EXEPTION HERE
System.out.println("ALL GOOD4.5");