Reputation: 1
GraphRequest request = GraphRequest.newGraphPathRequest( AccessToken.getCurrentAccessToken(), "/me/friends", new GraphRequest.Callback() { @Override public void onCompleted(GraphResponse response) { // Insert your code here
JSONObject jsonobject =response.getJSONObject();
try {
String data=jsonobject.getString("data");
JSONArray array= new JSONArray(data);
for (int i=0;i<array.length();i++) {
jsonFriend =array.getJSONObject(i);
for (int j=0 ; j <array.length();j++){
friend=new Friend();
friend.setId(jsonFriend.getString("id"));
friend.setName(jsonFriend.getString("name"));
JSONObject pictureObject=jsonFriend.getJSONObject("picture");
JSONObject pictureDataObject=pictureObject.getJSONObject("data");
PictureData pictureData=new PictureData() ;
Data data1=new Data();
data1.setUrl(pictureDataObject.getString("url"));
pictureData.setData(data1);
friend.setPictureData(pictureData);
}
friendmodelarraylist.add(friend);
}
ResponseAdapter adapter =new ResponseAdapter(friendmodelarraylist,HomeActivity.this);
listView.setAdapter(adapter);
listView.setItemsCanFocus(true);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Intent intent=new Intent(HomeActivity.this,FriendQuestios.class);
startActivity(intent);
}
});
} catch (JSONException e) {
e.printStackTrace();
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,picture");
request.setParameters(parameters);
request.executeAsync();
}
here is my manfist.xml` this prog must get fb friends in listview and it does but i couldnot click any item of this list
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity android:name=".activies.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activies.HomeActivity" />
<activity android:name=".activies.FriendQuestios"></activity>
Upvotes: 0
Views: 30
Reputation: 31
Have you got any focusable widget like edittext in your custom_list_item? It can be because of it. Try edittext focusable=false or replace with textview or anything.
Upvotes: 0