Home listview setOnItemClickListner isn't working not moving to another activity
Reply: 0

listview setOnItemClickListner isn't working not moving to another activity

user3210
1#
user3210 Published in July 21, 2018, 11:29 am

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>
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.3057 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO