Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void getdatafromfacebook(GraphResponse response) {
- JSONObject jsonObject = response.getJSONObject();
- arrayList = new ArrayList<>();
- if (response.getJSONObject().optJSONArray("data") != null) {
- next = jsonObject.optJSONObject("paging").optString("next");
- previous = jsonObject.optJSONObject("paging").optString("previous");
- for (int i = 0; i < jsonObject.optJSONArray("data").length(); i++) {
- Model model = new Model();
- JSONArray sender_data = jsonObject.optJSONArray("data").optJSONObject(i)
- .optJSONObject("senders").optJSONArray("data");
- for (int z = 0; z < sender_data.length(); z++) {
- JSONObject picture_data = sender_data.optJSONObject(z).optJSONObject("picture").optJSONObject("data");
- if (!sender_data.optJSONObject(z).optString("id").equals(user_id)) {
- model.setPage_conversation_user_id(sender_data.optJSONObject(z).optString("id"));
- model.setPage_conversation_user_picture(picture_data.optString("url"));
- model.setPage_conversation_user_name(sender_data.optJSONObject(z).optString("name"));
- }
- }
- model.setPage_conversation_id(jsonObject.optJSONArray("data").optJSONObject(i).optString("id"));
- model.setPage_conversation_user_message(jsonObject.optJSONArray("data").optJSONObject(i).optString("snippet"));
- arrayList.add(model);
- }
- adapter = new Page_Conversation_List_Adapter(Page_Conversation_list.this, arrayList);
- recyclerView.setAdapter(adapter);
- adapter.notifyDataSetChanged();
- adapter.setOnItemClickListener(this);
- } else {
- //No Message
- }
- }
Add Comment
Please, Sign In to add comment