mardi 20 janvier 2015

cannot read string result from MYSQL

I want to have an if else statement inside a loop when getting the results of

data from mysql .. However the if statement cannot read the result.. but the codes are perfectly

I see the problem in my if else condition.


here is my Code from my asynctask



for (int i = 0; i < markers.length(); i++) {

JSONObject c = markers.getJSONObject(i);

// Storing each json item in variable
Double LAT = c.getDouble(TAG_LAT);
Double LNG = c.getDouble(TAG_LNG);
String color = c.getString(TAG_STATUS);

String red = "ongoing";
String green = "firedout";

if (color == red){
LatLng position = new LatLng(LAT, LNG);
status.add(new MarkerOptions()
.title(color)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))
.position(position));
// adding HashList to ArrayList
}

if (color == green){
LatLng position = new LatLng(LAT, LNG);
status.add(new MarkerOptions()
.title(color)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN))
.position(position));
// adding HashList to ArrayList
}

}

Aucun commentaire:

Enregistrer un commentaire