I'm new to Android and programming in general so please excuse any conventions I don't meet. I need to combine an array and a if clause to be able to filter certain qualities.
My programme currently retrieves an several arraylists (say names, address, personal details etc) of items from a url connection, I want to put an if clause on one particular arraylist, for example ages, and if they meet a certain criteria return a different message than the standard.
So far I've tried the obvious:
while ((line = in.readLine()) != null) {
ja = new JSONArray(line);
// run through the length of the array
for (int i = 0; i < ja.length(); i++) {
JSONObject JO = (JSONObject) ja.get(i);
// if the rating of the restaurant is -1, exempt
// should be displayed
if (ratingValue.contains(-1)) {
ConcatenateSearchResults().add("Exempt");
}
// output to meet Basic Functionality requirement
businessNames.add(JO.getString("BusinessName"));
postCodes.add(JO.getString("PostCode"));
addressList1.add(JO.getString("AddressLine1"));
addressList2.add(JO.getString("AddressLine2"));
addressList3.add(JO.getString("AddressLine3"));
ratingValue.add(JO.getString("RatingValue"));
calcDistance.add(JO.getString("DistanceKM"));
}
}
Not effectively. Can anyone guide me as to how I should go about this?
Aucun commentaire:
Enregistrer un commentaire