开发者

How to share photo on Facebook through my Android App? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 11 years ago.

I am trying this, I got success in posting a note but how can I do it for a picture?

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 {
   开发者_JAVA技巧         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);
            }
        }
    }
}

from this code I am able to post any text but how can I share photo?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜