failing to do fb like to postId I have just shared successfully

Elad Benda

I have shared a url from my android app to FB:

I then save aside (hard coded) the postId

I try to do "fb like" to that post

using this code, but get an error:

Button socialBtn3 = (Button) dialog
                        .findViewById(R.id.socialBtn3);
                socialBtn3.setOnClickListener(new OnClickListener() {

                    String fbPostId = "685560152_10153809399380153";
                    @Override
                    public void onClick(View v) {

                        new LikeFbPostAsyncTask().execute(fbPostId);
                    }
                });

and this:

public class LikeFbPostAsyncTask extends AsyncTask<String, Void, Void> {

    public LikeFbPostAsyncTask() {
    }

    @Override
    protected void onPreExecute() {
        Log.i("LikeFbPostAsyncTask", "Starting web task...");
    }

    @Override
    protected Void doInBackground(String... fbPostId) {

        Request likeRequest = new Request(Session.getActiveSession(),
                fbPostId + "/likes", null, HttpMethod.POST,
                new Request.Callback() {

                    @Override
                    public void onCompleted(Response response) {
                        Log.i(TAG, response.toString());

                        // how to return to ui thread?
                        // return response;
                    }
                });
        Request.executeBatchAndWait(likeRequest);
        return null;

    }

    @Override
    protected void onPostExecute(Void res) {

    }
}

{Response: responseCode: 404, graphObject: null, error: {HttpStatus: 404, errorCode: 803, errorType: OAuthException, errorMessage: (#803) Some of the aliases you requested do not exist: [Ljava.lang.String;@4284cd10}, isFromCache:false}

how can i solve this?

Sean

You are sending an array of String arguments to the AsyncTask (String...). When extracting the desired string from the array you should do :

    Request likeRequest = new Request(Session.getActiveSession(),
            fbPostId[0] + "/likes", null, HttpMethod.POST,
            new Request.Callback() {

instead of:

Request likeRequest = new Request(Session.getActiveSession(),
        fbPostId + "/likes", null, HttpMethod.POST,
        new Request.Callback() {

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

未能执行fb之类的postId我刚刚成功共享

来自分类Dev

未能像我刚刚成功共享的postId那样做fb

来自分类Dev

Fb Like在Ember App中

来自分类Dev

I have an awk script and would like to print random records

来自分类Dev

How can I do pagination when downloading facebook posts via javascript and FB.api?

来自分类Dev

How do I change the boot menu when I have no display?

来自分类Dev

Why do I have to overload operators when implementing CompareTo?

来自分类Dev

How do I get my aliases to have correct completion?

来自分类Dev

根据postID删除重复的数据

来自分类Dev

使用Javascript获取Wordpress PostID

来自分类Dev

查找选定的 MapKit Annotation 的 postID

来自分类Dev

how do i use find, nm, and grep to find a symbol among many shared libraries?

来自分类Dev

Do I need to reset a shared_ptr before removing it from a vector?

来自分类Dev

Facebook打开图的fb:explicitly_shared是否需要开发人员批准?

来自分类Dev

How do I print out just certain elements from a text file that has xml tags to a new text file?

来自分类Dev

Do I need to set type face-manually to roboto-light if i am targeting api 11+ or can I just use android:fontFamily="sans-serif-light"

来自分类Dev

How can one enable keyboard like in iMessages/FB Messenger in landscape mode at iOS8?

来自分类Dev

How do I parse Json with an invalid character for a field name? e.g. { "file/folder": "/Shared/Salesforce/asdf.txt" } with Newtonsoft?

来自分类Dev

Does for comprehension have something like "flatYield"?

来自分类Dev

使用?postid = $ value查看特定的MySQL行

来自分类Dev

如果postid是新的,则插入mysql,否则更新

来自分类常见问题

In jQuery, how do I get the value of a radio button when they all have the same name?

来自分类Dev

Why do I have ambiguous handler methods mapped for HTTP path in my Spring Boot Rest Data Application?

来自分类Dev

Is GCC's option -O2 breaking this small program or do I have undefined behavior

来自分类Dev

Why do two web pages have different localStorage? How can I fix this?

来自分类Dev

What version of Hive do I need to have timestamps with more than 6 decimal places in the fractional seconds?

来自分类Dev

How do I have an Async function that writes out to a service bus queue?

来自分类Dev

Do i have to keep `DEVICE_ID_EMULATOR` as the device ID for ads

来自分类Dev

Is there a `shared_lock_guard` and if not, what would it look like?

Related 相关文章

  1. 1

    未能执行fb之类的postId我刚刚成功共享

  2. 2

    未能像我刚刚成功共享的postId那样做fb

  3. 3

    Fb Like在Ember App中

  4. 4

    I have an awk script and would like to print random records

  5. 5

    How can I do pagination when downloading facebook posts via javascript and FB.api?

  6. 6

    How do I change the boot menu when I have no display?

  7. 7

    Why do I have to overload operators when implementing CompareTo?

  8. 8

    How do I get my aliases to have correct completion?

  9. 9

    根据postID删除重复的数据

  10. 10

    使用Javascript获取Wordpress PostID

  11. 11

    查找选定的 MapKit Annotation 的 postID

  12. 12

    how do i use find, nm, and grep to find a symbol among many shared libraries?

  13. 13

    Do I need to reset a shared_ptr before removing it from a vector?

  14. 14

    Facebook打开图的fb:explicitly_shared是否需要开发人员批准?

  15. 15

    How do I print out just certain elements from a text file that has xml tags to a new text file?

  16. 16

    Do I need to set type face-manually to roboto-light if i am targeting api 11+ or can I just use android:fontFamily="sans-serif-light"

  17. 17

    How can one enable keyboard like in iMessages/FB Messenger in landscape mode at iOS8?

  18. 18

    How do I parse Json with an invalid character for a field name? e.g. { "file/folder": "/Shared/Salesforce/asdf.txt" } with Newtonsoft?

  19. 19

    Does for comprehension have something like "flatYield"?

  20. 20

    使用?postid = $ value查看特定的MySQL行

  21. 21

    如果postid是新的,则插入mysql,否则更新

  22. 22

    In jQuery, how do I get the value of a radio button when they all have the same name?

  23. 23

    Why do I have ambiguous handler methods mapped for HTTP path in my Spring Boot Rest Data Application?

  24. 24

    Is GCC's option -O2 breaking this small program or do I have undefined behavior

  25. 25

    Why do two web pages have different localStorage? How can I fix this?

  26. 26

    What version of Hive do I need to have timestamps with more than 6 decimal places in the fractional seconds?

  27. 27

    How do I have an Async function that writes out to a service bus queue?

  28. 28

    Do i have to keep `DEVICE_ID_EMULATOR` as the device ID for ads

  29. 29

    Is there a `shared_lock_guard` and if not, what would it look like?

热门标签

归档