Android Projects

Android Development Books


Android Facebook API example using FBRocket

This post is posted as per the request of many comments on Android JTwitter Example.
Now let proceed ahead with Facebook using FBrocket.
Using FB rocket we can update our facebook profile status from mobile application.
Before we get into coding we got to make sure that we do the following steps
  1. Import the FBrocket JAR file to the eclipse project and add it to JAR libraries. Download here ( )
  2. Make sure you have created an application in!/developers/createapp.php
  3. Note down application name and API key, do not reveal API key to anybody.
[sourcecode language="java"]
package org.androidpeople.facebook;
import net.xeomax.FBRocket.FBRocket;
import net.xeomax.FBRocket.Facebook;
import net.xeomax.FBRocket.LoginListener;
import net.xeomax.FBRocket.ServerErrorException;
import android.os.Bundle;
public class FacebookRocketExample extends Activity implements LoginListener {
private FBRocket fbRocket;
public void onCreate(Bundle savedInstanceState) {
public void shareFacebook() {
fbRocket = new FBRocket(this, "Your App Name",
"Your API Key");
if (fbRocket.existsSavedFacebook()) {
} else {
public void onLoginFail() {
fbRocket.displayToast("Login failed!");
public void onLoginSuccess(Facebook facebook) {
// TODO Auto-generated method stub
fbRocket.displayToast("Login success!");
try {
facebook.setStatus("This is your status");
fbRocket.displayDialog("Status Posted Successfully!! "
+ facebook.getStatus());
} catch (ServerErrorException e) {
if (e.notLoggedIn()) {
} else {
Screenshots :

You can download the full source code here
Share this post
  • Share to Facebook
  • Share to Twitter
  • Share to Google+
  • Share to Stumble Upon
  • Share to Evernote
  • Share to Blogger
  • Share to Email
  • Share to Yahoo Messenger
  • More...


Thanks for your comment

:) :-) :)) =)) :( :-( :(( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ :-$ (b) (f) x-) (k) (h) (c) cheer

Related Posts Plugin for WordPress, Blogger...
© Google Android Lovers
Designed by BlogThietKe Cooperated with Duy Pham
Released under Creative Commons 3.0 CC BY-NC 3.0