在Android中排序Facebook朋友生日列表月智慧

时间:2013-01-18 06:27:44

标签: android facebook facebook-graph-api facebook-fql facebook-android-sdk

  

可能重复:
  Hackbook sample code to Fetch List of Current Month Facebook Friends Birthdays

我制作了一个程序,其中获取我所有的 Facebook好友列表 ..

现在我想让我的模块更多为用户定制并希望允许用户查看他们的朋友列表月明智

问题:

How to sort Facebook Friends List those birthdays in Current Month or Week only...

获取所有朋友列表的代码:

 public static void requestFriends(FacebookRequest facebookRequest) {
Log.d(LOG_TAG, "requestFriends(" + ")");
String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me()) order by birthday_date";
Bundle params = new Bundle();
params.putString("method", "fql.query");
params.putString("query", query);
FacebookUtility.asyncRunner.request(null, params, 
new   FacebookRequestListener(FacebookRequestListener.FRIENDS, facebookRequest));
}

获取1月份生日那些朋友列表的代码:

String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me())AND birthday_date >= '01/01' AND birthday_date <= '01/31' ORDER BY birthday_date ASC";

1 个答案:

答案 0 :(得分:0)

根据我的理解,您已经知道如何从特定月份结交朋友。 虽然我不知道android我相信你只需要获取当前月份并将其插入到fql中。

Calendar c = Calendar.getInstance(); 
int month = c.get(Calendar.MONTH)
String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me())AND birthday_date >= '" + month+ "/01' AND birthday_date <= '" + month+ "/31' ORDER BY birthday_date ASC";

或类似的东西。