Hi there,

I am currently developing an application where it displays veterinary
locations on the mapview, this i have been able to do successfully, in
addition i have also got the users current location as well.

When users click on the ItemizedOverlay they can see the Veterinary
Title and below that the address for the snippet
What i would like to do is create a button named 'Call' so they can
easily ring the Vet up

I am trying to create Intent variables and then put them into an array
similarly the way the ItemizedOverlays have been created and put into
an array

What i want is that if the users clicks on Point1 the Info presented
should be for point1 as well as the phone number to be called, and so
on and so for

My Code is as follows:


List<Overlay> mapOverlays;
List<Intent> mapIntents;
NewItemizedOverlay itemizedOverlay;
Intent intentCall;

GeoPoint point = new GeoPoint((int)(51.555890943494276*1E6), (int)
(-0.39989858865737915*1E6));
OverlayItem overlayitem = new OverlayItem(point, "Greenwood
Veterinary" , "57 Station Approach, South Ruislip, Ruislip, Middlesex,
HA4 6SL, 020 8845 8144");
itemizedOverlay.addOverlay(overlayitem);

Intent vet1 = new
Intent(android.content.Intent.ACTION_DIAL,Uri.parse("tel:020 8845
8144")); // i created this in a similar fashion to the
itemizedOverlay
intentCall.?(vet1); // i wanted to try and do the same thing with the
addOverlay but i cant seem to find the correct method of doing this



class NewItemizedOverlay extends ItemizedOverlay {


        private ArrayList<OverlayItem> mOverlays = new
ArrayList<OverlayItem>();
        private ArrayList<Intent> cIntents = new ArrayList<Intent>();
        Context mContext;

        public NewItemizedOverlay(Drawable defaultMarker) {
                super(boundCenterBottom(defaultMarker));
        }

        public NewItemizedOverlay(Drawable defaultMarker, Context
context)
        {
                super(boundCenterBottom(defaultMarker));
                mContext = context;
        }

        public void addOverlay(OverlayItem overlay)
        {
                mOverlays.add(overlay);
                populate();
        }

        public void addOverlay(OverlayItem overlay, Intent intent)
        {
                mOverlays.add(overlay);
                cIntents.add(intent);
                populate();
        }

        @Override
        protected OverlayItem createItem(int i) {
                // TODO Auto-generated method stub
                return mOverlays.get(i);
        }

        protected Intent createCall(int c)
        {
                return cIntents.get(c);
        }

        @Override
        public int size() {
                // TODO Auto-generated method stub
                return mOverlays.size();
        }

        public int callsize()
        {
                return cIntents.size();
        }

        @Override
        protected boolean onTap(int index) {
          OverlayItem item = mOverlays.get(index);
          Intent callItem = cIntents.get(index);


          AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
          dialog.setIcon(android.R.drawable.ic_dialog_info);
          dialog.setTitle(item.getTitle());
          dialog.setMessage(item.getSnippet());
          dialog.setPositiveButton("OK", new
DialogInterface.OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                        // TODO Auto-generated method stub

                }
        });
          dialog.setNeutralButton("Call", new
DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                                // TODO Auto-generated method stub
                                VetNumber. //Not sure how to exactly call the 
Intent
                        }
                });
          dialog.show();
          return true;
        }

    }


If anyone can help me with this i would be most grateful, i need to
finish this off for my university project and the deadline is in 2
weeks :(

Thank You

-- 
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

Reply via email to