 |
|
คือผมอยากจะดึงค่าที่ได้จะการ Query แล้วเก็บไว้ใน ArrayList มาใช้ ต้องทำยังไงครับ
Code
try {
JSONArray data = new JSONArray(getJSONUrl(url));
final ArrayList<HashMap<String, String>> MyArrList = new ArrayList<HashMap<String, String>>();
HashMap<String, String> map;
for(int i = 0; i < data.length(); i++){
JSONObject c = data.getJSONObject(i);
map = new HashMap<String, String>();
map.put("id", c.getString("poi_id"));
map.put("name", c.getString("poi_name"));
map.put("latitude", c.getString("poi_latitude"));
map.put("longitude", c.getString("poi_longitude"));
MyArrList.add(map);
}
แล้วนำค่า latitude, longitude, name มาใส่ในสีแดง
Code
mMap.addMarker(new MarkerOptions().position(
new LatLng(Double.toString(latitude), Double.toString(longitude)))
.title(name));
Tag : Mobile, MySQL, Android, JAVA
|
|
 |
 |
 |
 |
Date :
2014-03-10 10:23:42 |
By :
gungsakab |
View :
1076 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |