FaceBook Image Share in android


//After login,



public void login() {
facebook.authorize(
FaceBookAuthentication.this,
new String[] { "user_photos,publish_checkins,publish_actions,publish_stream" },
new DialogListener() {

public void onFacebookError(FacebookError e) {
showToast("Authentication with Facebook failed!");
finish();

}

public void onError(DialogError e) {
showToast("Authentication with Facebook failed!");
finish();

}

public void onComplete(Bundle values) {
postImage();
Toast.makeText(getApplicationContext(),
"Image Successfully Posted on Facebook.",
Toast.LENGTH_SHORT).show();

Intent i = new Intent(FaceBookAuthentication.this,
HairMagic.class);
startActivity(i);

}

public void onCancel() {
showToast("Authentication with Facebook cancelled!");
finish();

}
});


public void postImage() {
byte[] data = null;

Bundle params = new Bundle();
params.putString(Facebook.TOKEN, facebook.getAccessToken());
params.putString("method", "photos.upload");
params.putByteArray("picture", imageName.bytearray);
AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebook);
mAsyncRunner.request(null, params, "POST", new SampleUploadListener(),
null);

}