Passing an Id to a AlertDialog click event
<p>I have a mapview with pointers, when a pointer is clicked I show an alertdialog.
In this dialog I have a bit of text and two buttons, a positive and negative.
When the positive is clicked I want to open a new activity based on the id of the pointer clicked.</p>

<p>I am new to Android and  java and I am having trouble passing the ID to the click event.</p>

<p>My code so far..</p>

<pre><code>       List&lt;myItemType&gt; myItems= //code to get list of items
                final ArrayList&lt;OverlayItem&gt; items = new ArrayList&lt;OverlayItem&gt;(

    );

            for (myItemType item : myItems) {

            Double lat = Double.parseDouble(item .Lat);
            Double lng = Double.parseDouble(item .Long);

            items.add(new OverlayItem(item .ID, item .Name, item .Description
                    .substring(0, 20) + "...", new GeoPoint(lat, lng)));
        }
    ItemizedOverlay&lt;OverlayItem&gt; myOverLay = 
            new ItemizedOverlay&lt;OverlayItem&gt;(
                this, items, this.getResources().getDrawable(R.drawable.standard_pointer), new Point(5, 5),
                HotspotPlace.BOTTOM_CENTER, new ItemizedOverlay.OnItemGestureListener&lt;OverlayItem&gt;() 
                {
                    @Override
                    public boolean onItemSingleTapUp(final int index,final OverlayItem item) {

                        AlertDialog.Builder dialog = new AlertDialog.Builder(MapActivity.this);

                        dialog.setTitle(item.mTitle);
                        dialog.setMessage(item.mDescription);
                        dialog.setPositiveButton(R.string.View,new DialogInterface.OnClickListener() 
                        {

//********************CLICK EVENT HERE
                                    @Override
                                    public void onClick(DialogInterface dialog,int which) {
                                        Intent i = new Intent(MapActivity.this,POI.class);
                                        i.putExtra("Id", item.mKey); //&lt;------ item.mKey is null!
                                        startActivity(i);
                                    }
                        });
                        dialog.setNegativeButton(R.string.Cancel, null);
                        dialog.create();
                        dialog.show();

                        return true;
                    }
</code></pre>

<p>The Id is stored in the "item.mKey", I know I can't access it directly, but I can't work out how to pass it in.
Can anyone point me in the right direction?</p>

<p>Bex </p>
