簡體   English   中英

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

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

我正在寫一個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));
}

無論何時我運行我的應用程序,我都沒有得到任何數據,但是我的3個朋友在2月生日,但我沒有得到那些生日。

我的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

你需要改變以下代碼希望它不起作用。

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