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 9105237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:03:25+00:00 2026-06-17T02:03:25+00:00

I am using this sample code https://github.com/chrtatu/FacebookFriendsList to get the list of FB friends

  • 0

I am using this sample code https://github.com/chrtatu/FacebookFriendsList to get the list of FB friends with their names and profile pics.
Here I try to get their DOB as well, but in place of DOB, I get null value.
please help to fetch that.

My Code:

  String[] facebook_permissions = { "user_photos", "friends_birthday", "friends_photos" };

  ==========================================================================

   public class FriendListAdapter extends BaseAdapter implements SectionIndexer {
    private LayoutInflater mInflater;
    private String[] sections;
    private GetProfilePictures picturesGatherer = null;
    FriendsList friendsList;
    Hashtable<Integer, FriendItem> listofshit = null;

    public FriendListAdapter(FriendsList friendsList) {
        Log.d(LOG_TAG, "FriendListAdapter()");
        this.friendsList = friendsList;
        sections = new String[getCount()];
        listofshit = new Hashtable<Integer, FriendItem>();
        for (int i = 0; i < getCount(); i++) {
            try {
                sections[i] = jsonArray.getJSONObject(i).getString("name").substring(0, 1);
                sections[i] = jsonArray.getJSONObject(i).getString("birthday").substring(0, 2);
            } catch (JSONException e) {
                sections[i] = "";
                Log.e(LOG_TAG, "getJSONObject: " + e.getMessage());
            }
        }
        if (picturesGatherer == null) {
            picturesGatherer = new GetProfilePictures();
        }
        picturesGatherer.setAdapterForListener(this);
        mInflater = LayoutInflater.from(friendsList.getBaseContext());
    }

    public int getCount() {
        Log.d(LOG_TAG, "getCount()");
        if (jsonArray == null)
            return 0;
        return jsonArray.length();
    }

    public Object getItem(int position) {
        Log.d(LOG_TAG, "getItem()");
        return listofshit.get(position);
    }

    public long getItemId(int position) {
        Log.d(LOG_TAG, "getItemId()");
        return position;
    }

    public View getView(int position, View convertView, ViewGroup parent) {
        Log.d(LOG_TAG, "getView(" + position + ")");

        JSONObject jsonObject = null;
        try {
            jsonObject = jsonArray.getJSONObject(position);
        } catch (JSONException e) {
            Log.e(LOG_TAG, "getJSONObject: " + e.getMessage());
        }

        FriendItem friendItem;

        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.single_friend, null);
            friendItem = new FriendItem();

            convertView.setTag(friendItem);
        }
        else {
            friendItem = (FriendItem) convertView.getTag();
        }

        friendItem.friendPicture = (ImageView) convertView.findViewById(R.id.picture_square);
        friendItem.friendName = (TextView) convertView.findViewById(R.id.name);
        friendItem.friendDob = (TextView) convertView.findViewById(R.id.dob);
        friendItem.friendLayout = (RelativeLayout) convertView.findViewById(R.id.friend_item);

        try {
            String uid = jsonObject.getString("uid");
            String url = jsonObject.getString("pic_square");
            friendItem.friendPicture.setImageBitmap(picturesGatherer.getPicture(uid, url));
        } catch (JSONException e) {
            Log.e(LOG_TAG, "getJSONObject: " + e.getMessage());
            friendItem.friendName.setText("");
            friendItem.friendDob.setText("");
        }

        try {
            friendItem.friendName.setText(jsonObject.getString("name"));
            friendItem.friendDob.setText(jsonObject.getString("birthday"));
        } catch (JSONException e) {
            Log.e(LOG_TAG, "getJSONObject: " + e.getMessage());
            friendItem.friendName.setText("");
            friendItem.friendDob.setText("");
        }

        listofshit.put(position, friendItem);

        return convertView;
    }

    public int getPositionForSection(int position) {
        return position;
    }

    public int getSectionForPosition(int position) {
        return position;
    }

    public Object[] getSections() {
        return sections;
    }
}

class FriendItem {
    TextView friendDob;
    int id;
    ImageView friendPicture;
    TextView friendName;
    RelativeLayout friendLayout;

}

==============================================================================

String query = "select name, uid, pic_square, birthday from user where uid in 
(select uid2 from friend where uid1=me()) order by name";
  • 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-17T02:03:26+00:00Added an answer on June 17, 2026 at 2:03 am

    Instead of these two lines of code:

     sections[i] = jsonArray.getJSONObject(i).getString("name").substring(0, 1);
     sections[i] = jsonArray.getJSONObject(i).getString("birthday").substring(0, 2);
    

    Use below two lines:

    sections[i] = jsonArray.getJSONObject(i).getString("name").substring(0);
    sections[i] = jsonArray.getJSONObject(i).getString("birthday").substring(1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using this absolute amazing piece of code: https://github.com/plancake/official-library-php-email-parser/blob/master/PlancakeEmailParser.php But the one thing
I can compile this JNA example code (from step 2 of https://github.com/twall/jna/#getting_started ): package
I'm using this great plugin: https://github.com/maranomynet/linkify/blob/master/1.0/jquery.linkify-1.0.js to link text manipulating the dom. The problem
I using sorcery for email activation and I've followed their wiki tutorial: https://github.com/NoamB/sorcery/wiki/User-Activation .
I am using the sample code of paypal in php from https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/library_code but whenever
I've been using the sample code from this d3 project to learn how to
I've seen on this site a StringBuilder code sample illustrating AppendFormat usage: using System;
i have this simple code to load data from other php page using get
I'm trying to use a ThreadPool implementation from this fellow: https://github.com/progschj/ThreadPool I'm having trouble
I'm looking into using the REST plugin here: https://github.com/kvz/cakephp-rest-plugin for providing an API that

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.