private void loadCarDetails() { // TODO Auto-generated method stub String url = "http://www.unitedcarexchange.com/MobileService/ServiceMobile.svc/FindCarID/" + getIntent().getStringExtra("CAR_ID") + "/" + aid + "/" + uid + "/"; JSONParser jParser = new JSONParser(); JSONObject json = jParser.getJSONFromUrl(url); // System.out.println("this is url" + url); try { // Getting Array of Contacts contacts = json.getJSONArray("FindCarIDResult"); if (contacts != null) { for (int i = 0; i < contacts.length(); i++) { jsonobject = contacts.getJSONObject(i); imageURL = domainName + jsonobject.getString("_PICLOC1").replace(" ", "%20").replace("Emp", "") + jsonobject.getString("_PIC0").replace(" ", "%20").replace("Emp", ""); // .replace("Emp", ""); // System.out.println("this is imageurl" + imageURL); ImageLoaders imageLoader = new ImageLoaders(getApplicationContext()); imageLoader.displayImage(imageURL, imageView); phone = jsonobject.getString("_phone"); // System.out.println("this is phone" + phone); email = jsonobject.getString("_email"); /*address = jsonobject.getString("_city").trim().replace("Emp", "") + "," + " " + jsonobject.getString("_state").trim().replace("Emp", "") + " " + jsonobject.getString("_zip").replace("Emp", "");*/ if (jsonobject.getString("_city").equals("Emp")) { address = jsonobject.getString("_state").trim().replace("Emp", "") + " " + jsonobject.getString("_zip").replace("Emp", ""); } else { address = jsonobject.getString("_city").trim().replace("Emp", "") + "," + " " + jsonobject.getString("_state").trim().replace("Emp", "") + " " + jsonobject.getString("_zip").replace("Emp", ""); } price1 = jsonobject.getString("_price").trim(); make1 = jsonobject.getString("_make").trim(); model1 = jsonobject.getString("_model").trim(); year1 = jsonobject.getString("_yearOfMake").trim(); bodystyle = jsonobject.getString("_bodytype"); exteriorcolor1 = jsonobject.getString("_exteriorColor"); interiorcolor1 = jsonobject.getString("_interiorColor"); doors = jsonobject.getString("_numberOfDoors"); vehiclecondition = jsonobject.getString("_ConditionDescription"); mileage = jsonobject.getString("_mileage"); fuel1 = jsonobject.getString("_Fueltype"); transmission = jsonobject.getString("_Transmission"); engine = jsonobject.getString("_numberOfCylinder"); drivetrain = jsonobject.getString("_DriveTrain"); vin1 = jsonobject.getString("_VIN"); description = jsonobject.getString("_description"); carInfo.setPIC1( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC1").replace(" ", "%20").replace("Emp", "")); carInfo.setPIC2( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC2")); carInfo.setPIC3( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC3")); carInfo.setPIC4( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC4")); carInfo.setPIC5( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC5")); carInfo.setPIC6( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC6")); carInfo.setPIC7( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC7")); carInfo.setPIC8( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC8")); carInfo.setPIC9( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC9")); carInfo.setPIC10( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC10")); carInfo.setPIC11( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC11")); carInfo.setPIC12( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC12")); carInfo.setPIC13( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC13")); carInfo.setPIC14( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC14")); carInfo.setPIC15( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC15")); carInfo.setPIC16( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC16")); carInfo.setPIC17( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC17")); carInfo.setPIC18( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC18")); carInfo.setPIC19( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC19")); carInfo.setPIC20( domainName + jsonobject.getString("_PICLOC1") + jsonobject.getString("_PIC20")); NumberFormat format = NumberFormat.getCurrencyInstance(); format.setMinimumFractionDigits(0); NumberFormat Millageformat = NumberFormat.getNumberInstance(); Millageformat.setMinimumIntegerDigits(1); Phone1.setText(phone); Email.setText(email); Email.setText("Send an email to seller " + ""); SpannableString emailunderline = new SpannableString("Send an email to seller " + ""); emailunderline.setSpan(new UnderlineSpan(), 0, emailunderline.length(), 0); Email.setText(emailunderline); Zip.setText(address); price.setText(price1); Make.setText(make1); Model.setText(model1); Year.setText(year1); tv_year.setText(year1 + " " + make1 + " " + model1); Bodystyle.setText(bodystyle); exteriorcolor.setText(exteriorcolor1); interiorcolor.setText(interiorcolor1); Doors.setText(doors); ConditionDescription.setText(vehiclecondition); Millage.setText(Millageformat.format(Double.parseDouble(mileage + "")) + " Mi"); fuel.setText(fuel1); Engione.setText(engine); Transmission.setText(transmission); Drive.setText(drivetrain); if (vin1.equals("Emp")) { Vin.setText(""); } else { Vin.setText(vin1); } if (description.equals("Emp")) { Description.setText(""); } else { Description.setText(description); } for (int j = 0; j <= 20; j++) { if (jsonobject.getString("_PIC1").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC1()); } if (jsonobject.getString("_PIC2").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC2()); } if (jsonobject.getString("_PIC3").equalsIgnoreCase("Emp")) { break; // } else { carGallerList.add(carInfo.getPIC3()); } if (jsonobject.getString("_PIC4").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC4()); } if (jsonobject.getString("_PIC5").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC5()); } if (jsonobject.getString("_PIC6").equalsIgnoreCase("Emp")) { break; // } else { carGallerList.add(carInfo.getPIC6()); } if (jsonobject.getString("_PIC7").equalsIgnoreCase("Emp")) { break; // } else { carGallerList.add(carInfo.getPIC7()); } if (jsonobject.getString("_PIC8").equalsIgnoreCase("Emp")) { } else { carGallerList.add(carInfo.getPIC8()); } if (jsonobject.getString("_PIC9").equalsIgnoreCase("Emp")) { } else { carGallerList.add(carInfo.getPIC9()); } if (jsonobject.getString("_PIC10").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC10()); } if (jsonobject.getString("_PIC11").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC11()); } if (jsonobject.getString("_PIC12").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC12()); } if (jsonobject.getString("_PIC13").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC13()); } if (jsonobject.getString("_PIC14").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC14()); } if (jsonobject.getString("_PIC15").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC15()); } if (jsonobject.getString("_PIC16").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC16()); } if (jsonobject.getString("_PIC17").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC17()); } if (jsonobject.getString("_PIC18").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC18()); } if (jsonobject.getString("_PIC19").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC19()); } if (jsonobject.getString("_PIC20").equalsIgnoreCase("Emp")) { break; } else { carGallerList.add(carInfo.getPIC20()); } break; } } } else { Toast.makeText(getApplicationContext(), "No Deatils for this car", Toast.LENGTH_LONG) .show(); } } catch (JSONException e) { e.printStackTrace(); Toast.makeText( getApplicationContext(), "Server Error occured,Please try again", Toast.LENGTH_LONG) .show(); } Email.setOnClickListener( new OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Intent frequentMessages = new Intent(getApplicationContext(), EmailActivity.class) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); frequentMessages.putExtra("Make", Make.getText().toString()); frequentMessages.putExtra("Model", Model.getText().toString()); frequentMessages.putExtra("Price", price.getText().toString()); frequentMessages.putExtra("Year", Year.getText().toString()); frequentMessages.putExtra("Cid", getIntent().getStringExtra("CAR_ID")); frequentMessages.putExtra("Phone", phone + ""); startActivity(frequentMessages); } }); }