Re: [android-developers] Google Android Map Overlay

2010-11-20 Thread Frank Weiss
The Android SDK doesn't provide this functionality ready-to-go, but it can
be easily implemented with a custom view class that extends FrameLayout, a
controller class, a nine-patch image, and a layout resource (XML). You ought
to be able to google for several solutions. Try the keyords mapview and
balloon.

IMO implementing it yourself is a valuable exercise that adds to your
understanding of the Android SDK.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Re: [android-developers] Google Android Map Overlay

2010-11-22 Thread devian yudha
yeah i think SDK doesn't provide us to that functionality, so you must
included other things like .XML which give us a layout resource, etc.

On 11/21/10, Frank Weiss  wrote:
> The Android SDK doesn't provide this functionality ready-to-go, but it can
> be easily implemented with a custom view class that extends FrameLayout, a
> controller class, a nine-patch image, and a layout resource (XML). You ought
> to be able to google for several solutions. Try the keyords mapview and
> balloon.
>
> IMO implementing it yourself is a valuable exercise that adds to your
> understanding of the Android SDK.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] Google Android Map Overlay

2010-11-29 Thread search . light . com
I wrote a sample which jpeg image is displaying when you click the overlay.
I think that maybe could be helpful as a reference.


(MapViewTouchSample.java)
package com.ma.chupic.chu.com.beta.activity;

import java.util.ArrayList;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.OverlayItem;

public class MapViewTouchSample extends MapActivity {
private Drawable touchedLocationIcon;
private TouchedItemizedOverlay touchedItemizedOverlay;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
touchedLocationIcon = getResources().getDrawable(R.drawable.icon);
touchedItemizedOverlay = new
TouchedItemizedOverlay(touchedLocationIcon, this);
((MapView) findViewById(R.id.MapView)).getOverlays().add(new Overlay() {
@Override
public boolean onTap(GeoPoint p, MapView mapView) {
Log.v(this.getClass().getName(), "Overlay.onTap start.");
super.onTap(p, mapView);
String locationPoint = new StringBuilder()
.append("latitude: ")
.append(p.getLatitudeE6())
.append(", longitude:")
.append(p.getLongitudeE6())
.toString();
OverlayItem overlayItem = new OverlayItem(p, locationPoint, "");
touchedItemizedOverlay.clearOverlay();
touchedItemizedOverlay.addOverlay(overlayItem);
mapView.getController().animateTo(p);
mapView.getOverlays().add(touchedItemizedOverlay);
mapView.invalidate();
return true;
}
});
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
class TouchedItemizedOverlay extends ItemizedOverlay {
private ArrayList overlays = new ArrayList();
Context context;
public TouchedItemizedOverlay(Drawable defaultMarker, Context context) {
super(boundCenterBottom(defaultMarker));
this.context = context;
}
@Override
protected boolean onTap(int index) {
super.onTap(index);
String title = getItem(index).getTitle();
Toast.makeText(context, title, 3).show();
return true;
}
@Override
protected OverlayItem createItem(int i) {
return overlays.get(i);
}
@Override
public int size() {
return overlays.size();
}
void addOverlay(OverlayItem overlay) {
overlays.add(overlay);
populate();
}
void clearOverlay() {
overlays.clear();
populate();
}
}


--
Regards
Twitter: @machupicchubeta


On Sun, Nov 21, 2010 at 12:41, devian yudha  wrote:
> yeah i think SDK doesn't provide us to that functionality, so you must
> included other things like .XML which give us a layout resource, etc.
>
> On 11/21/10, Frank Weiss  wrote:
>> The Android SDK doesn't provide this functionality ready-to-go, but it can
>> be easily implemented with a custom view class that extends FrameLayout, a
>> controller class, a nine-patch image, and a layout resource (XML). You ought
>> to be able to google for several solutions. Try the keyords mapview and
>> balloon.
>>
>> IMO implementing it yourself is a valuable exercise that adds to your
>> understanding of the Android SDK.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups "Android Developers" group.
>> To post to this group, send email to android-developers@googlegroups.com
>> To unsubscribe from this group, send email to
>> android-developers+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/android-developers?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en