1
我正在使用Facebook的sdk,並且試圖修改父函數中的變量(這就是我至少稱之爲的)。使用回調訪問父變量
我該如何修改變量「演員」(標記)?
public void getUserFeed(int limit) {
String q = ""; // query taken out
Bundle params = new Bundle();
params.putString("q", q);
Session session = Session.getActiveSession();
Request request = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
public void onCompleted(Response response) {
GraphObject graphObject = response.getGraphObject();
if (graphObject != null) {
JSONObject jsonObject = graphObject.getInnerJSONObject();
try {
JSONArray array = jsonObject.getJSONArray("data");
for (int i = 0; i < array.length(); i++) {
String q = "" // query taken out
Bundle params = new Bundle();
params.putString("q", q);
String actor = ""; // Trying to access this variable *******
Session session = Session.getActiveSession();
Request request2 = new Request(session,
"/fql",
params,
HttpMethod.GET,
new Request.Callback(){
public void onCompleted(Response response) {
GraphObject graphObject = response.getGraphObject();
//String s = textViewResults.getText().toString();
if (graphObject != null) {
JSONObject jsonObject = graphObject.getInnerJSONObject();
try {
JSONArray array = jsonObject.getJSONArray("data");
for (int i = 0; i < array.length(); i++) {
JSONObject object = (JSONObject) array.get(i);
actor = object.getString("name"); // Trying to access "actor" here *******
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
});
}
}
}
}
}
);
}