Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- "from": {
- "name": "A",
- "id": "123456"
- },
- "to": {
- "data": [
- {
- "name": "B",
- "id": "123456789"
- }
- ]
- },
- JSONObject recipientData = story.getJSONObject("to");
- JSONArray recipientArray = recipientData.getJSONArray("data");
- JSONObject recipient = recipientArray.getJSONObject(0);
- recipientName = recipient.getString("name");
- String recipientId = recipient.getString("id");
- // if the post's recipient is also a tagged user, then this is not a post to
- // another user's wall, but rather a status update. Leave the recipient blank then.
- if(story.has("message_tags")){
- JSONObject tags = story.getJSONObject("message_tags");
- for(int tagIdx = 0; tagIdx < tags.names().length() ; tagIdx++){
- JSONArray tagArray = tags.getJSONArray(tags.names().getString(tagIdx));
- String tagId = tagArray.getJSONObject(0).getString("id");
- if(tagId.equals(recipientId)){
- recipientName = "";
- break;
- }
- }
- }
Add Comment
Please, Sign In to add comment