List of all Upcoming Facebook Friends Birthdays in Android
Asked Answered
S

1

0

How to get Facebook Friends Birthdays in order of upcoming like: show top on list those birthdays are coming next by using current date and so on.

still i am getting birthdays in form of January to December, Getting Friends on Top those birthdays in January and on bottom those birthdays in December.

and i am also getting friends on top those birthdays has gone in January like birthday was on 2nd Jan or 28 Jan,

Now i just want to see list of Next Upcoming Birthdays,those passed away on bottom of the list...

Like here:

https://itunes.apple.com/in/app/birthday-sweet-birthday-calendar/id367346406?mt=8

https://play.google.com/store/apps/details?id=com.scoompa.birthdayreminder&hl=en

they have shown recents on top and later on bottom in a List...

Still i am using this query :

    String query = "select name, birthday, uid, pic_square from user where uid in (select uid2 from friend where uid1=me()) order by birthday_date";

Also Tried with this code:

 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";
Salimeter answered 31/1, 2013 at 8:53 Comment(0)
G
1

You can sort the list of friends according to their birthday. like,

SELECT uid, name, birthday_date FROM user
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=me())
AND birthday_date >= CURRENT_DATE
AND birthday_date <= LAST_DATE
ORDER BY birthday_date ASC

Here in place of CURRENT_DATE you could enter the current system date. So this will show the upcoming birthday from the current date. and in place of LAST_DATE, you could use the date upto which you want to show the upcoming birthdays.

Gregale answered 31/1, 2013 at 11:4 Comment(5)
buddy i have tried with this: 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"; but not getting any list...Salimeter
So, what you are getting in the month variable.? Is it 2(February).? Do you know february doesnt have any 31 Date.? Are you sure, you have some friends whose birthday falls in between 1 February to the date you have used.?Gregale
i am not getting list of friends even, please tell me what i should write and where i am doing mistake need help buddy..Salimeter
@Rakesh, Dont panic, first check that what value you are getting in the month variable. try printing some Log to check its value.Gregale
thanks again for fast reply, ok buddy i will try that and then get back to you, for now thanks again...Salimeter

© 2022 - 2024 — McMap. All rights reserved.