Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.regularticket.socke.regularticket;
- import com.facebook.GraphResponse;
- import com.google.gson.Gson;
- import org.json.JSONArray;
- import org.json.JSONException;
- import org.json.JSONObject;
- import java.io.IOException;
- import java.text.ParseException;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.List;
- /**
- * Created by Adde on 2017-11-19.
- */
- public class Place {
- private String name, city, country, street;
- private float longitude, latitude;
- int zip;
- public Place(String name, String city, String street, String country, float latitude, float longitude, int zip){
- this.name = name;
- this.city = city;
- this.country = country;
- this.longitude = longitude;
- this.latitude = latitude;
- this.street = street;
- this.zip = zip;
- }
- public Place(){}
- public String getName() {
- return name;
- }
- public String getCity() {
- return city;
- }
- public String getCountry() {
- return country;
- }
- public String getStreet() {
- return street;
- }
- public float getLong() {
- return longitude;
- }
- public float getLat() {
- return latitude;
- }
- public int getZip() {
- return zip;
- }
- public Place fetchPlace(GraphResponse place_response) throws IOException, JSONException, ParseException {
- System.out.println("FetchPlace");
- JSONObject root = place_response.getJSONObject();
- System.out.println(root);
- Gson g = new Gson();
- Place place= g.fromJson(String.valueOf(root), Place.class);
- System.out.println("PLACE NAME");
- System.out.println(place.getName());
- // Place place = new Place();
- return place;
- }
- }
- /*
- JSONObject root = place_response.getJSONObject();
- JSONObject data = root.getJSONObject("place");
- String name_from = jsonData.getString("name");
- JSONObject jsonData = data.getJSONObject(0);
- for (int i = 0; i < data.length(); i++) {
- JSONObject jsonData = data.getJSONObject(i);
- String name_from = jsonData.getString("name");
- JSONObject fromObject = new JSONObject(name_from);
- String from_feed = fromObject.getString("name");
- String event_id = jsonData.getString("id");
- //String event_message ="message";
- String message_timeStamp = jsonData.getString("updated_time");
- if(jsonData.has("message")){
- String event_message = jsonData.getString("message");
- String updated_stamp = YourEventFragment.dateConverter(message_timeStamp, "FB");
- Date message_date = YourEventFragment.stringToDate(updated_stamp);
- Feed feed = new Feed(from_feed, event_message, event_id, message_date);
- allFeedMessages.add(feed);
- }
- }
- //Log.v("all events!!!!!!!!!!!", allFeedMessages.get(0).getName());
- return allFeedMessages;
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement