0
String queryApp = "SELECT display_name, namespace  FROM application WHERE app_id=7256235347";
                Bundle paramsApp = new Bundle();
                paramsApp.putString("method", "fql.query");
                paramsApp.putString("query", queryApp);
                String resultApp = Util.facebook.request(paramsApp);

                Log.e("APP RESULT", resultApp);

                JSONArray JAApp = new JSONArray(resultApp);

                for (int i = 0; i < JAApp.length(); i++) {
                    JSONObject JOApp = JAApp.getJSONObject(i);

                    String getDisplayName = JOApp.getString("display_name");
                    Log.e("DISPLAY NAME", getDisplayName);
                }

上面一行中的“facebook”显示错误..有什么想法吗?

4

1 回答 1

1

Util.facebook里面没有com.facebook.android.Util

正确的方法是

import com.facebook.android.Facebook;
import com.facebook.android.AsyncFacebookRunner;

...

Facebook facebook = new Facebook(YOUR_APP_ID);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);

// all your paramsApp bundle code
...

mAsyncRunner.request(paramsApp, new BaseRequestListener() {
   ...
});
于 2012-12-12T18:45:02.077 回答