Guest User

Untitled

a guest
Jul 20th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. "from": {
  2. "name": "A",
  3. "id": "123456"
  4. },
  5. "to": {
  6. "data": [
  7. {
  8. "name": "B",
  9. "id": "123456789"
  10. }
  11. ]
  12. },
  13.  
  14. JSONObject recipientData = story.getJSONObject("to");
  15. JSONArray recipientArray = recipientData.getJSONArray("data");
  16. JSONObject recipient = recipientArray.getJSONObject(0);
  17. recipientName = recipient.getString("name");
  18. String recipientId = recipient.getString("id");
  19.  
  20. // if the post's recipient is also a tagged user, then this is not a post to
  21. // another user's wall, but rather a status update. Leave the recipient blank then.
  22. if(story.has("message_tags")){
  23. JSONObject tags = story.getJSONObject("message_tags");
  24. for(int tagIdx = 0; tagIdx < tags.names().length() ; tagIdx++){
  25. JSONArray tagArray = tags.getJSONArray(tags.names().getString(tagIdx));
  26. String tagId = tagArray.getJSONObject(0).getString("id");
  27. if(tagId.equals(recipientId)){
  28. recipientName = "";
  29. break;
  30. }
  31. }
  32. }
Add Comment
Please, Sign In to add comment