简体   繁体   English

在列表中显示当前日期Facebook朋友生日

[英]Show Current Date Facebook Friend Birthdays in List

I am writing an app in which i am fetching list of friends those birthdays in next 30 days, and i am able to get that as well, but i am facing a small problem in my list. 我正在编写一个应用程序,在该应用程序中,我将在接下来的30天内获取那些生日的朋友列表,我也能做到这一点,但是我在列表中遇到了一个小问题。

Like: I have 4 friends birthdays in next 30 days, so i am getting list of coming facebook friends birthdays but not getting name of friend whom birthday is Today 像:在接下来的30天里,我有4个朋友的生日,所以我得到了即将到来的Facebook朋友生日的列表,但没有得到生日是今天的朋友的名字

I guess i am missing something in query. 我想我在查询中丢失了一些东西。

Code: 码:

     Calendar cal = Calendar.getInstance();
    Date today = cal.getTime();
    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");
    String today_formatted = formatter.format(today);
    cal.add(Calendar.DATE, 30);  //set number of days
    String today_plus30_formatted = formatter.format(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 != 'null' AND birthday_date > '" + today_formatted + "'AND birthday_date < '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";

and if i will use below query, so i am not getting list of my friends: 如果我将使用下面的查询,所以我没有得到我的朋友列表:

               String query = "select name, birthday, uid, pic_square FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me()) AND birthday_date != 'null' AND birthday_date > = '" + today_formatted + "'AND birthday_date < = '" + today_plus30_formatted + "'ORDER BY birthday_date ASC";

Rakesh you did everything and that is correct also: Rakesh您做了所有事情,这也是正确的:

you just need to delete : "/yyyy" 您只需要删除:“ / yyyy”

replace below line, and you done: 替换下面的行,您就完成了:

    SimpleDateFormat formatter = new SimpleDateFormat("MM/dd");

Are you sure gave permission for accessing friends Birthday date 您确定授予访问朋友的权限生日吗?

private static final String[] PERMISSIONS =
new String[] {"friends_birthday","read_stream", "offline_access"};

http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/ http://www.androidhive.info/2012/03/android-facebook-connect-tutorial/

here is simple example 这是一个简单的例子

How to get FB friends birthday in Android 如何在Android中获得FB朋友生日

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

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