2

Can anybody have demo code to get user data (like Username,last name) from his facebook account in to the java code? I have gone thru the sample API but it will help me to reduce my work if I can use some reusable code.

Thank you hp

Himanshu
  • 1,989
  • 16
  • 12
Gendaful
  • 5,522
  • 11
  • 57
  • 76
  • TO be more specific, when user Logsin , He should get the username, his basic info like name, lastname and his likes.Thank you – Gendaful Apr 20 '11 at 00:51
  • 2
    Facebook API is homework now? I remember professors doing everything they could to keep kids off facebook in lecture. "The times, they are a changin'" – corsiKa Apr 20 '11 at 00:51
  • Hmmm, if I remember correctly "reusable code" in school when I was in school was synonymous with "cheating." Are you sure the point of the assignment wasn't to write said code? – Chris Thompson Apr 20 '11 at 00:53
  • No sir :), its not assignment :) – Gendaful Apr 20 '11 at 00:55
  • possible duplicate of [How can I use Facebook JAVA API in my application?](http://stackoverflow.com/questions/2022336/how-can-i-use-facebook-java-api-in-my-application) – Mohamed Mansour Apr 20 '11 at 01:07
  • Duplicate - http://stackoverflow.com/questions/2022336/how-can-i-use-facebook-java-api-in-my-application – Mohamed Mansour Apr 20 '11 at 01:07

2 Answers2

2

Facebook Java API Google Group: http://code.google.com/p/facebook-java-api/

Examples of the FB Java API (including what you're looking for): http://code.google.com/p/facebook-java-api/wiki/Examples


One suggestion I have would be to use Google Web Toolkit and/or the Apache HTTP Client.

GWT: http://code.google.com/webtoolkit/ Let's you write complex web-app code in Java, and automatically ports it to Javascript for you. No servlets required.

Apache HTTP Client: http://hc.apache.org/httpcomponents-client-ga/ Provides helper methods for things such as AJAX calls, sending/receiving data, passing cookies/parameters with requests, etc.

Just have a look at Facebook's API, and mess around with either of these tools. Also, have a look at these official Facebook resources:

Facebook API Sandbox: https://developers.facebook.com/tools/console/

Facebook Developer App: https://www.facebook.com/developers/

Sample Apps: https://developers.facebook.com/docs/samples/

AlexFZ
  • 1,439
  • 1
  • 13
  • 22
1

Note that the facebook-java-api project is now dead.

Use instead: http://restfb.com/

Black
  • 5,023
  • 6
  • 63
  • 92