i’m trying to show facebook user’s profile pic using facebook graph api url and user’s name.
String Name = jsonObjectlike.getString("name");
String UserIds = jsonObjectlike.getString("id");
URL url = new URL("https://graph.facebook.com/" + listid + "/picture?type=small");
Bitmap bmp = BitmapFactory.decodeStream(url.openConnection().getInputStream());
HashMap<String, String> contact = new HashMap<>();
contact.put("picid", bmp);
contact.put("name", Name);
contactList.add(contact);
and here is simpleAdapter to show in listview:
SimpleAdapter adapter = new SimpleAdapter(MainActivity.this, contactList,R.layout.activity_listview, new String[]{"picid", "name"}, new int[]{R.id.imageView1,R.id.name});
simpleList.setAdapter(adapter);
I successfully show name in the listView but image is not showing,
3
Answers
I fixed myself by creating custom listView adapter that contains decoded image url and text. It works perfect for me.
And in your SimpleAdapter handle is picid and show in Imageview with Glide library.