Android :: Facebook like button

后端 未结 1 1596
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 13:48

I\'m learning how to use the Facebook SDK, and i like to put a like button to the application i\'m testing on it, and unfortunately i\'m doing something wrong, so can you please

1条回答
  •  后悔当初
    2021-01-24 14:31

    Get the id of the post that you want to like and store it in fbPostId.

    Then, inside the onClickHandler of your like button, put the following code snippet :

    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());
             }
    });
    Request.executeBatchAndWait(likeRequest);
    

    0 讨论(0)
提交回复
热议问题