Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid : Hello, Views > Google Map View Tuorial
    primarykey
    data
    text
    <p>I'm trying to complete the Android MapView tutorial @ www.developer.android.com/resources/tutorials/views/hello-mapview.html</p> <p>I think I've done the entire thing correctly but I'm getting an error message in Eclipse. I'm sure why. The problematic line of code is </p> <pre><code>private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); </code></pre> <p>I'm relatively new to Java but I've gone through the forums of different things and I really have no idea on this one. I've [attached][2] a screen shot of the development environment - hopefully it wont be anything too obvious or hard to fix either!</p> <p><a href="http://www.limedomains.com/files/download/34780?dirname=&amp;file_name=hellogooglemaps.jpg" rel="nofollow noreferrer">http://www.limedomains.com/files/download/34780?dirname=&amp;file_name=hellogooglemaps.jpg</a></p> <p>Cheers</p> <p>Tom :)</p> <p>** As requested heres the source code and the screenshot link is updated to something that works**</p> <pre><code>package com.example.hellogooglemaps; import java.util.ArrayList; import android.app.AlertDialog; import android.content.Context; import android.graphics.drawable.Drawable; import com.google.android.maps.GeoPoint; import com.google.android.maps.ItemizedOverlay; import com.google.android.maps.Overlay; import com.google.android.maps.OverlayItem; private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); public class HelloItemizedOverlay extends ItemizedOverlay{ public HelloItemizedOverlay(Drawable defaultMarker) { super(boundCenterBottom(defaultMarker)); } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } public void addOverlay(OverlayItem overlay) { mOverlays.add(overlay); populate(); } @Override public int size() { return mOverlays.size(); } public HelloItemizedOverlay(Drawable defaultMarker, Context context) { super(defaultMarker); mContext = context; } @Override protected boolean onTap(int index) { OverlayItem item = mOverlays.get(index); AlertDialog.Builder dialog = new AlertDialog.Builder(mContext); dialog.setTitle(item.getTitle()); dialog.setMessage(item.getSnippet()); dialog.show(); return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload