Issue
I'm fetching all the 's stores in "Göteborg" and adding a marker on my mapView. The problem is that with this code my markers get all bunched up in Africa.
I've checked that coordinates is correct so it isnt that.
Anyone know what's the problem is?
df = ((ClassHandler)getApplication()).getStoreDatabadeFacade();
Cursor plotstore = df.getAllStorePos("Göteborg");
startManagingCursor(plotstore);
plotstore.moveToFirst();
while(plotstore.isAfterLast() == false){
GeoPoint addStore = new GeoPoint(plotstore.getColumnIndex("lat"), plotstore.getColumnIndex("long"));
//OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_ID")), plotstore.getString(plotstore.getColumnIndex("ADDRESS")));
OverlayItem overlayitem = new OverlayItem(addStore, plotstore.getString(plotstore.getColumnIndex("_id")), plotstore.getString(plotstore.getColumnIndex("address")));
itemizedStoreOverlay.addOverlay(overlayitem);
storeOverlays.add(itemizedStoreOverlay);
plotstore.moveToNext();
}
Solution
Doesn't getColumnIndex
just return the index of the column within the cursor
, rather than the value at that index? You seem to be using it correctly for the id
:
plotstore.getString(plotstore.getColumnIndex("_id"))
but not for the lat
and long
:
plotstore.getColumnIndex("lat")
Try changing this (and the "long"
) to:
plotstore.getInt(plotstore.getColumnIndex("lat"))
Answered By - dave.c
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.