如何通过我的Android应用程序在Facebook上分享照片?

我正在尝试这种方式,我在张贴便笺时获得了成功,但我怎样才能做到这一点?

import net.xeomax.FBRocket.FBRocket;
import net.xeomax.FBRocket.LoginListener;
import net.xeomax.FBRocket.ServerErrorException;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Bundle;

public class Facebook extends Activity implements LoginListener {

    private FBRocket fbRocket;
    int i;
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        shareFacebook();
    }

    public void shareFacebook() {
        fbRocket = new FBRocket(this, "PitchFork TRY","c3968bbdd9dc7f44a8e05b7346f46673");
        if (fbRocket.existsSavedFacebook()) {
            fbRocket.loadFacebook();
        } else {
            fbRocket.login(R.layout.main);
        }
    }

    //@Override
    public void onLoginFail() {
        fbRocket.displayToast("Login failed!");
    }
    //@Override
    public void onLoginSuccess(net.xeomax.FBRocket.Facebook facebook) {
        // TODO Auto-generated method stub
        fbRocket.displayToast("Login success!");
        Drawable bm = getResources().getDrawable(R.drawable.abook);
        try {
            facebook.setStatus("Hi, Friends this is post by me from my Android App, ");

            fbRocket.displayDialog("Status Posted Successfully!! ");

        } catch (ServerErrorException e) {
            if (e.notLoggedIn()) {
                fbRocket.login(R.layout.main);
            } else {
                System.out.println(e);
            }
        }
    }
}

从这段代码我可以发布任何文字,但我怎样才能分享照片?

链接地址: http://www.djcxy.com/p/26223.html

上一篇: How to share photo on Facebook through my Android App?

下一篇: Getting an exception when app starts