Facebook请求OnComplete中的返回值

时间:2014-04-29 01:56:51

标签: android facebook asynccallback facebook-requests

我怀疑的是,当我调用下面的方法时,值为null,当然,因为对象用户尚未填充,因为将填充在Facebook请求中。所以,问题是,我如何等待Facebook完成然后返回正确的用户群?

public ArrayList<User> getUsers(){

     ArrayList<User> users = new ArrayList<User>();
     User user = new User();
     //It's not the complete code 
     Facebook.resquest(){
         @Override
         onComplete(){
              for(int i = 0;i<10;i++){                
                users.add(user)
              }
         }
     }
   // The question is, what do i have to do for the below object 'll have the same value of    user object inside facebook request?

     return users;
}

1 个答案:

答案 0 :(得分:0)

使用Request.executeAndWait(request);

在返回之前,在代码中