-1

可能重复:
获取当前月份 Facebook 好友生日列表的 Hackbook 示例代码

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

现在我想让我的模块对用户更加自定义,并希望允许用户查看他们的好友列表 Month Wise

问题:

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));
}

获取一月份生日的朋友列表的代码:

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";
4

1 回答 1

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";

或类似的东西。

于 2013-01-18T07:37:02.263 回答