【发布时间】:2017-10-18 20:45:44
【问题描述】:
GraphRequest 请求 = GraphRequest.newGraphPathRequest( AccessToken.getCurrentAccessToken(), “/我/朋友”, 新的 GraphRequest.Callback() { @覆盖 公共无效onCompleted(GraphResponse响应){ // 在此处插入您的代码
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();
}
这是我的 manfist.xml` 这个 prog 必须在 listview 中获得 fb 朋友,它确实可以,但我无法单击此列表中的任何项目
<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>
【问题讨论】:
-
你有日志吗?
-
代码没有问题,它只是不响应我的点击,这就是点击它时发生的情况 app:id/list_friends}, event = MotionEvent { action=ACTION_UP, id[0]=0 , x[0]=267.4428, y[0]=210.61053, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=39461958,停机时间=39461838, deviceId=3, source=0x1002 }
-
向我们展示您的 AndroidManifest.xml
标签: android