简体   繁体   English

如何在Android中获得本月Facebook朋友生日列表

[英]How to get Current Month Facebook Friends Birthdays List in Android

I am writing a Facebook Android Application , in which i want to show list of Facebook Friends those Birthdays in Current Month , I am using below code to get that:- 我正在写一个Facebook Android应用程序 ,其中我想在本月显示Facebook朋友那些生日 列表 ,我使用下面的代码来得到它: -

    public static void requestFriends(FacebookRequest facebookRequest) 
    {
    Log.d(LOG_TAG, "requestFriends(" + ")");

    Calendar c = Calendar.getInstance();
    int month = c.get(Calendar.MONTH) + 1;
    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";

    Bundle params = new Bundle();
    params.putString("method", "fql.query");
    params.putString("query", query);
    FacebookUtility.asyncRunner.request(null, params, 
    new FacebookRequestListener(FacebookRequestListener.FRIENDS, facebookRequest));
}

whenever i run my application, i am not getting any data, However my 3 friends Birthdays in February, but i am not getting those birthdays. 无论何时我运行我的应用程序,我都没有得到任何数据,但是我的3个朋友在2月生日,但我没有得到那些生日。

My Logcat says:- 我的Logcat说: -

02-18 16:14:39.918: I/Choreographer(978): Skipped 78 frames!  The application may be doing too much work on its main thread.
02-18 16:14:39.918: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:39.928: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.078: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.078: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.108: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.108: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.148: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.148: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.188: I/FacebookUtility(978): LoginListener onComplete Bundle[{access_token=AAAF2qLBdroMBAGZBbot29pzoZAKbOWJkK5GDIxUCz8g0IFnhCO9yclfHevmvZCFJ4ObQSH0aY055x6ILPbFgSuqVjl7EaWYo4MKbLb8BgZDZD, expires_in=5164038, code=AQDqK2l6gUcRILPfFl87Z290PhZQfDhmQValGvFU77bqbnM91wOtcI3MMIL-Usvs49XDVlnbnjZ_mNiPn9a6-CC11rY2Z-aUTb0yz8S6IophHApQstnfnK9mCJNI_BwGsYyyvv9pZ3gbaGSC5IHpryzatZyZGnBlvo5CZXg6h_drmgd6Gfe6e4akqXWJsnSsXUe4ion-jUysuniGNu3Bnbp7}]
02-18 16:14:40.188: D/Facebook Friends(978): onLoginResultReceived(0)
02-18 16:14:40.218: D/FacebookUtility(978): requestFriends()
02-18 16:14:40.239: I/Choreographer(978): Skipped 83 frames!  The application may be doing too much work on its main thread.
02-18 16:14:40.239: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.248: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.248: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.278: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.428: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0
02-18 16:14:40.428: W/Trace(978): Unexpected value from nativeGetEnabledTags: 0

you need to change the follow code hope it ill work. 你需要改变以下代码希望它不起作用。

Calender cal = Calendar.getInstance();
cal.get(Calender.YEAR);
String yr = cal.gettime();
String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me())AND birthday_date like '"+ yr+ month+"%' ORDER BY birthday_date ASC";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM