Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8867649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:05:55+00:00 2026-06-14T17:05:55+00:00

I tried to use the fql query to get json response,I used this code

  • 0

I tried to use the fql query to get json response,I used this code for doing this

   String postid=jsonObject.getString("id");

   String query = "SELECT likes.user_likes FROM stream WHERE post_id = \'" + postid + "'";

    Bundle params = new Bundle();
   params.putString("method", "fql.query");
    params.putString("query", query);

   String fqlResponse = Utility.mFacebook.request(params);

   System.out.println(fqlResponse);

But I am getting null pointer exception at Utility.mFacebook.request(params);

I am using the default class in Github

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T17:05:56+00:00Added an answer on June 14, 2026 at 5:05 pm

    I personally find the Facebook Graph API a little inadequate at times. For example, in your current requirement, if you need to use just the Graph API, you will need to first, get a list of all Users who have liked a particular post. After you have a list, you will then have to check if the User ID matches that of the logged in User and then, based on the result, run a function or something.

    Instead, FQL offers a simpler function. In my app, for the exact same function, I exclusively make use of FQL.

    You can fire a simple query. For example:

    SELECT likes.user_likes FROM stream WHERE post_id ='XXXXXXXXXXXXX_XXXXXXXXX'
    

    Replace the X’s with the Post’s ID. Make sure you surround the Post ID with ‘YOUR_POST_ID’

    Try it like this in the Graph API Explorer: fql?q=SELECT likes.user_likes FROM stream WHERE post_id = 'ENTER_YOUR_POST_ID'

    After running the query, you should get a result that looks this this:

    {
      "data": [
        {
          "likes": {
            "user_likes": true
          }
        }
      ]
    }
    

    If the User likes the Post, the field user_likes will be true and false if the User has not liked the Post.

    You can parse the result like this (pseudo code):

    if (JOLikeStatus.has("likes")) {
        JSONObject optLikes = JOLikeStatus.optJSONObject("likes");
    
        if (optLikes.has("user_likes")) {
            String getUserLikes = optLikes.getString("user_likes");
    
            if (getUserLikes.equals("true")) {
                String getLikeStatus = "true";
            } else if (getUserLikes.equals("false")) {
                String getLikeStatus = "false";
            }
        } else {
            String getLikeStatus = null;
        }
    } else {
        String getLikeStatus = null;
    }
    

    EDIT 2: To get the number (count) of total likes, modify the earlier query like this:
    fql?q=SELECT likes.user_likes, likes.count FROM stream WHERE post_id = 'ENTER_YOUR_POST_ID'

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to use facebook fql.video get video from my Idol's wall, then, how
I have this code and it crashes every 1-2th launch. I have tried use
I tried to use this snippet from the Soundcloud API: <script src=http://connect.soundcloud.com/sdk.js> <script> SC.initialize({
I've managed to get a JSON output from my database for use with jQuery
I'm doing this facebook comments for a friend and I can't get any info
I want to parse this site : http://its.wonju.go.kr/movinginfo2/DetailSub/StopDetail.asp?StopID=1959# So I tried use TFHpple. Like
I have attempted to encrypt this string with MD5: lolno I use the module
I tried use javascript spilt to get part of the word : new from
I tried use js to change my url from http://localhost/text/index.php#mainpage%20menu1 to http://localhost/text/index.php#homepage%20menu1 My code
$(input[name='add'].my).click(function(){ //i tried use this <input type=button name=add value=..../> //element to find his parent's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.