8
下午好。在我的应用程序从数据库上parse.com标记提取数据:创建一个标记数组Google地图V2
public void ParseQueryMap() {
ParseQuery query = new ParseQuery("MyObject");
query.findInBackground(new FindCallback() {
public void done(List<ParseObject> myObject, ParseException e) {
if (e == null) {
for (int i = 0; i < myObject.size(); i++) {
commGet = myObject.get(i).getString("Comment");
geo1Dub = myObject.get(i).getParseGeoPoint("location").getLatitude();
geo2Dub = myObject.get(i).getParseGeoPoint("location").getLongitude();
Location aLocation = new Location("first");
aLocation.setLatitude(geo1Dub);
aLocation.setLongitude(geo2Dub);
Location bLocation = new Location("second");
bLocation.setLatitude(location.getLatitude());
bLocation.setLongitude(location.getLongitude());
int distance = (int)aLocation.distanceTo(bLocation);
if (distance<rad) { // where "rad" radius display points
myMap.addMarker(new MarkerOptions().position(new LatLng(geo1Dub,geo2Dub)).title(commGet) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
} else {
}
}
} else {
Toast.makeText(MainActivity.this, "Error!", Toast.LENGTH_SHORT).show();
}
}
});
我要创建标记,以检验其大小的数组,如果是零,则表明AlertDialog。也就是说,我想知道我得到了多少子弹。感谢您的帮助
更新:我想知道有多少标记在地图
上显示,问题是....? – 2013-03-15 13:52:23
当您为列表 myObject的每个条目添加标记时,我认为您拥有myObject.getSize()标记。 –
AlexVogel
2013-03-15 13:53:09
myObject.getSize()显示数据库中的记录数。我计划继续计算我的位置和基地点之间的距离,现在我需要知道我旁边的标记以及哪些不是。 – 2013-03-15 14:33:49