I've seen all the posts about using setLastFocusedIndex(-1). I've
tried that but my app is still crashing. I don't know what else to do
to fix it. Any help is appreciated.
public class UnitOverlay extends ItemizedOverlay {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>
();
private HashMap<String, Drawable> symbols = new HashMap<String,
Drawable>();
private String restClientURL;
public UnitOverlay(Drawable defaultMarker, String restClientURL) {
super(boundCenterBottom(defaultMarker));
this.restClientURL = restClientURL;
populate();
}
@Override
public void draw(Canvas pCanvas, MapView pMapView, boolean pShadow)
{
super.draw(pCanvas, pMapView, false);
}
public void clearOverlay(){
mOverlays.clear();
setLastFocusedIndex(-1);
populate();
}
public void addOverlay(GeoPoint loc, ViewItem item) {
setLastFocusedIndex(-1);
OverlayItem oi = new OverlayItem(loc, item.getName(), "");
if(symbols.containsKey(item.getImageURL())){
oi.setMarker(symbols.get(item.getImageURL()));
}
else{
Bitmap b = RestClient.getImage(restClientURL +
item.getImageURL());
BitmapDrawable bd = new BitmapDrawable(b);
symbols.put(item.getImageURL(), bd.getCurrent());
if(b != null){
oi.setMarker(bd);
}
else{
Log.i("blah", "no image");
}
}
mOverlays.add(oi);
}
public void populateOverlay(){
setLastFocusedIndex(-1);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
@Override
public int size() {
return mOverlays.size();
}
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en