public void parseData(String service, String result) { double[] coordinates = MappingUtility.getLocationCoords(this); Points points = new Points(coordinates[0], coordinates[1]); Intent intent = new Intent(this, CameraActivity.class); intent.putExtra("service", service); switch (service) { case "buy": ArrayList<BuyFlatStructure> buyFlatStructureArrayList = parseBuyData(result); MappingUtility.updateAngleAndDistance(buyFlatStructureArrayList, points); PropertyData.getInstance().setBuyProperties(buyFlatStructureArrayList); break; case "rent": ArrayList<RentFlatStructure> rentFlatStructureArrayList = parseRentData(result); MappingUtility.updateAngleAndDistance(rentFlatStructureArrayList, points); PropertyData.getInstance().setRentProperties(rentFlatStructureArrayList); break; case "pg": ArrayList<PgFlatStructure> pgFlatStructureArrayList = parsePgData(result); MappingUtility.updateAngleAndDistance(pgFlatStructureArrayList, points); PropertyData.getInstance().setPgProperties(pgFlatStructureArrayList); break; } startActivity(intent); this.finish(); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_display_flats_list); listView = (ListView) findViewById(R.id.listView); gson = new Gson(); Intent intent = getIntent(); String service = intent.getStringExtra("service"); String result = intent.getStringExtra("result"); parseData(service, result); PropertyData.init(); }