title: Get facebook friends list of logged user
body: <p>I want to get the Facebook friends for the user who has already logged in via the Facebook widget that it is integrated with my app.</p>
  
  <p>I created an activity that retrieves the friends list, however it doesn't work for me. (I also have the Facebook ID of the logged in user in the <code>String id</code> variable).</p>
  
  <pre><code>public class FreindsActivity extends Activity {
  
      Facebook mFacebook;
      String name,password,email,id,phone,emailOwner;
      AsyncFacebookRunner mAsyncRunner;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          setContentView(R.layout.profile_page);
  
  
          Intent intent = getIntent();
          name = intent.getExtras().getString("name");
          password = intent.getExtras().getString("password");
          email = intent.getExtras().getString("email");
          id = intent.getExtras().getString("id");
          phone = intent.getExtras().getString("phone");
          emailOwner=intent.getExtras().getString("emailOwner");
  
  
          mFacebook=new Facebook(id);
          mAsyncRunner = new AsyncFacebookRunner(mFacebook);
          mAsyncRunner.request("me/friends", new FriendsRequestListener());
  
  
          //Bundle params = new Bundle();
         // params.putString("fields", "name,id");
      }
  
  
  
      public class FriendsRequestListener implements com.facebook.android.AsyncFacebookRunner.RequestListener 
      {
          /**
           * Called when the request to get friends has been completed.
           * Retrieve and parse and display the JSON stream.
           */
          public void onComplete(final String response)
          {
              try 
              {
                  // process the response here: executed in background thread
                  JSONObject json = Util.parseJson(response);
                  JSONArray friendsData = json.getJSONArray("data");
                  String ids[]=new String[friendsData.length()] , names[] = new String[friendsData.length()];
                  for(int i = 0; i &lt; friendsData .length(); i++){ 
                       ids[i] = friendsData .getJSONObject(i).getString("id");
                       names[i] = friendsData .getJSONObject(i).getString("name");
                 }
  
  
  
  
              }
              catch (JSONException e)
              {
              }
          }
  
          @Override
          public void onComplete(String response, Object state) {
              // TODO Auto-generated method stub
  
              try 
              {
  
                  JSONObject json = Util.parseJson(response);
                  JSONArray friendsData = json.getJSONArray("data");
                  String ids[]=new String[friendsData.length()] , names[] = new String[friendsData.length()];
                  for(int i = 0; i &lt; friendsData .length(); i++){ 
                       ids[i] = friendsData .getJSONObject(i).getString("id");
                       names[i] = friendsData .getJSONObject(i).getString("name");
                  }
              }
              catch (JSONException e){
  
              }
  
          }
  
          @Override
          public void onIOException(IOException e, Object state) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onFileNotFoundException(FileNotFoundException e,
                  Object state) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onMalformedURLException(MalformedURLException e,
                  Object state) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onFacebookError(FacebookError e, Object state) {
              // TODO Auto-generated method stub
  
          }
      }
  
  }
  </code></pre>
  
  <p>LogCat:</p>
  
  <pre><code>03-13 17:24:33.396: E/AndroidRuntime(846): FATAL EXCEPTION: Thread-107
  03-13 17:24:33.396: E/AndroidRuntime(846): com.facebook.android.FacebookError: An active access token must be used to query information about the current user.
  03-13 17:24:33.396: E/AndroidRuntime(846):  at com.facebook.android.Util.parseJson(Util.java:272)
  03-13 17:24:33.396: E/AndroidRuntime(846):  at com.example.salebook.FreindsActivity$FriendsRequestListener.onComplete(FreindsActivity.java:87)
  03-13 17:24:33.396: E/AndroidRuntime(846):  at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:276)
  </code></pre>
  
  <p>thanks</p>