我想从mysql获取
数据的结果时在循环中有一个if else语句..但是if语句无法读取结果..但代码完美
我看到这个问题在我的情况下。无法从MYSQL读取字符串结果
这里是我的代码从我的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
}
}
我觉得你如果要是(颜色==“绿色”) – Joseph 2015-01-21 04:40:09
我认为,这样一个条件小姐something.do一些像这样的事情..当我删除if语句..我的标题正在获得状态..和标记被添加到他们相应的标题的地图 – 2015-01-21 04:42:10
没有它不起作用..存储在我的数据库中的数据基本上是“正在进行”和“开除”只有..所以如果结果正在进行中,标记的颜色必须是红色,如果结果被触发,它必须是绿色的。 – 2015-01-21 04:54:21