Question

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.

Was it helpful?

Solution

(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");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top