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

  • Home
  • SEARCH
  • 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 7757499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T13:06:41+00:00 2026-06-01T13:06:41+00:00

I have created a map marker that is positioned on my map by finding

  • 0

I have created a map marker that is positioned on my map by finding the users location, but I am trying to add strings to the map marker and cannot get it to work. Here is my onCreate method where the location is set. The last part of the method shows placing pinpoint at location, I thought that the overlay item would take string parameters as follows:

      @Override
        public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.map);

        // Displaying Zooming controls
        mapView= (MapView) findViewById(R.id.mapView);
        mapView.setBuiltInZoomControls(true);

        //Manually place a pin by touching the map
        touchy t = new touchy();
        overlayList = mapView.getOverlays();
        overlayList.add(t);
        compass = new MyLocationOverlay(Maps.this, mapView);
        overlayList.add(compass);
        controller = mapView.getController();


        d = getResources().getDrawable(R.drawable.androidmarker);


      //placing pinpoint at location
        lm =(LocationManager) getSystemService(Context.LOCATION_SERVICE);
        Criteria crit = new Criteria();

        towers = lm.getBestProvider(crit, false);

        Location location = lm.getLastKnownLocation(towers);

        if(location != null){

            lat = (int) (location.getLatitude()* 1E6);
            longi = (int) (location.getLongitude()* 1E6);

              GeoPoint ourLocation = new GeoPoint(lat, longi);
              controller.animateTo(ourLocation);
            controller.setZoom(6);
            OverlayItem overlayitem = new OverlayItem(ourLocation, "First string", "Second string");
            HelloItemizedOverlay custom = new HelloItemizedOverlay(d, Maps.this);
            custom.insertPinpoint(overlayitem);
            overlayList.add(custom);
        }
        else{
            Toast.makeText(Maps.this, "Couldn't get provider", Toast.LENGTH_SHORT).show();
        }

    }

Can anyone see what I am doing wrong? Is this the wrong way to do this? Eventually I want to pass a name and high-score to the location which will be retrieved from another class as two strings.

I appreciate any advice at all.

  • 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-06-01T13:06:42+00:00Added an answer on June 1, 2026 at 1:06 pm

    Follow the following tutorial:
    http://codemagician.wordpress.com/2010/05/06/android-google-mapview-tutorial-done-right/

    In this he is creating an ItemizedOverly

    HelloItemizedOverlay extends ItemizedOverlay<OverlayItem>
    

    This will help you in adding a map overlay with text

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

Sidebar

Related Questions

have created a map that I'm trying to have function similar to 'My Maps'.
I am trying to display the map i have created using the Iterator. The
I'm trying to make a Google map that updates a marker as a user's
I have a module I created for Google Maps v3 that I'm trying to
I hope someone can help with this. I have created a map app that
Right now I have google map code that will set a single marker on
I have an OpenLayers map with a marker and a popup that's supposed to
I am new to iphone development.I have created map applications and displayed the cuurent
I have an ArcGIS map created with Flex. The labels created dynamically are the
I have created a function that loops through a set of returned JSON. I

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.