listview setOnItemClickListner不会移动到另一个活动

时间:2017-10-18 20:45:45

标签: android

GraphRequest request = GraphRequest.newGraphPathRequest(             AccessToken.getCurrentAccessToken()             " / ME /朋友&#34 ;,             新的GraphRequest.Callback(){                 @覆盖                 public void onCompleted(GraphResponse response){                     //在此处插入代码

                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`这个编程必须在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>

1 个答案:

答案 0 :(得分:0)

您的custom_list_item中是否有像edittext一样的可聚焦小部件?可能是因为它。尝试使用edittext focusable = false或使用textview或任何内容替换。