Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7589411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:09:08+00:00 2026-05-30T20:09:08+00:00

i am trying google map first time i got a some tutorial from From

  • 0

i am trying google map first time i got a some tutorial from From this site

where we can pin a location but it does not show pin a particular location on click the code is given below

public class GoogleActivity extends MapActivity 
{    
    MapView mapView; 
    MapController mc;
    GeoPoint p;

class MapOverlay extends com.google.android.maps.Overlay
{


    @Override
    public boolean draw(Canvas canvas, MapView mapView, 
    boolean shadow, long when) 
    {
        super.draw(canvas, mapView, shadow);                   

        //---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);

        //---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(
            getResources(), R.drawable.ic_launcher);            
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);         
        return true;
    }
} 

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.mapView);
    LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);  
    View zoomView = mapView.getZoomControls(); 



    zoomLayout.addView(zoomView, 
        new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, 
            LayoutParams.WRAP_CONTENT)); 
    mapView.displayZoomControls(true);

    mc = mapView.getController();
    String coordinates[] = {"1.352566007", "103.78921587"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint(
        (int) (lat * 1E6), 
        (int) (lng * 1E6));

    mc.animateTo(p);
    mc.setZoom(17); 
    mapView.invalidate();


     //---Add a location marker---
     MapOverlay mapOverlay = new MapOverlay();
     List<Overlay> listOfOverlays = mapView.getOverlays();
     listOfOverlays.clear();
     listOfOverlays.add(mapOverlay);        

     mapView.invalidate();
}

@Override
protected boolean isRouteDisplayed() {
    // TODO Auto-generated method stub
    return false;
}
}

now what i need is that i want to pin a location when i chick a particular location. How can i implement a click event in google map

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:09:09+00:00Added an answer on May 30, 2026 at 8:09 pm

    THe MapOverlay class has an onTap() method you can override. It will be called when you tab on the map and a GeoPoint object will be passed as a parameter describing the location that was taped.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am trying to display google map on Android refering to this tutorial http://developer.android.com/resources/tutorials/views/hello-mapview.html
I am trying to display google map on my application.. For this I am
I am trying to dynamically move a google map (v3) from one div to
im trying to apply this JSON code to my Google Map: [ { stylers:
I'm trying to create a custom javascript class that inherits from google.maps.Map (V3 API).
I'm trying to extend jWysiwyg with an function to add a map from Google
I'm trying to load a map generated with Google Maps API on a site.
Im trying out the Google Maps API Geocoding feature.The map loads fine, but im
Am trying to dispaly a basic google map on my application but that's not
I'm trying to transfer Rails-generated json into Google Maps markers on a map, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.