1

Got stuck in a situation. I'm totally new to android. I used Facebook Android SDK https://github.com/facebook/facebook-android-sdk

I followed this tutorial http://www.integratingstuff.com/2010/10/14/integrating-facebook-into-an-android-application/

this helps me to log in and post to user's wall. Now I want to collect friends' information.

From this topic Facebook API for Android: how to get extended info regarding user`s friends? I found a simple way to do that.

Bundle bdle=new Bundle();
    bdle.putString("fields","birthday");
JSONObject json = Util.parseJson(facebook.request("me/friends",bdle));

Now when I print this json,I can see id and birth dates. Now I can't find a way to separate them and also not found anything on search. It gives me all friends' ID and birth dates all together. something like :

{"data":[{"id":"12345","birthday":03/29"},{"id":"12678","birthday":06/22"}],.......

I preferred this ,because it prevents application to fetch a single friend's id to get a single date,rather provides me altogether.

Now please help me to break this json and separate this information into two array,like a[1]="12345";b[1]="03/29"

And if anyone can provide me any simple example/tutorial link on facebook integration with android specially in asynchronous way that would be a great help.

Community
  • 1
  • 1
AtanuCSE
  • 8,832
  • 14
  • 74
  • 112
  • How to accept a answer! Also I don't have enough reputation to mark as a answer.Each time I click the arrow,it says I need 15 reputation to select answer.So I'm finding it complicated. And If I'm not satisfied with answer or can't find what I'm looking for,how can I accept! And thanks for advising to break the question.I'll if I can't find solution by myself.@nd one is optional. – AtanuCSE Jan 11 '12 at 18:54
  • Looks like you got your rating to 100%. Excellent. Hopefully more developers with android experience will be able to assist you. If an answer is the answer to your question but it involves too much work to accomplish, that doesn't make it the wrong answer, it only makes it an answer you dont wanna do. Or if the answer is "It can't be done" when you're looking for a "Heres how to get it done", that doesn't invalidate the can't be done answer for a question that cannot be done. – DMCS Jan 11 '12 at 20:15

1 Answers1

0

(Answered in a question edit. Converted to a community wiki answer. See Question with no answers, but issue solved in the comments (or extended in chat) )

The OP wrote:

Solved the problem:

JSONArray jsonarr=json.getJSONArray("data");
JSONObject j=jsonarr.getJSONObject(0);
s1=j.getString("name");
s2=j.getString("birthday");
Community
  • 1
  • 1
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129