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 8192791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:15:21+00:00 2026-06-07T04:15:21+00:00

I already made a simple android application, which I also have integrated Google Maps

  • 0

I already made a simple android application, which I also have integrated Google Maps in it..
It is also capable of connecting to MySQL (localhost) to display my desired places using longitude and latitude values..
My question is, is it possible to make another overlay item above Google Maps when a marker is clicked (just like what happens in foursquare)?

To be specific, i want to display a text that contains the name of a place.

Heres my class of displaying the overlay items.
I made an onTap method, but it display a dialog box, I want to display a simple text box that shows the name of the place.

    package finddroid.map;

import java.util.ArrayList;

import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Paint;
import android.graphics.Point;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.text.TextPaint;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.ItemizedOverlay;
import com.google.android.maps.MapView;
import com.google.android.maps.OverlayItem;

public class CustomItemizedOverlay extends ItemizedOverlay<OverlayItem>
{

    private int markerHeight;

    private ArrayList<OverlayItem> mapOverlays = new ArrayList<OverlayItem>();

    private Context context;

    public CustomItemizedOverlay(Drawable defaultMarker)
    {
        super(boundCenterBottom(defaultMarker));
        markerHeight = ((BitmapDrawable) defaultMarker).getBitmap().getHeight();
        populate();
    }

    public CustomItemizedOverlay(Drawable defaultMarker, Context context)
    {
        this(defaultMarker);
        this.context = context;
    }

    @Override
    protected OverlayItem createItem(int i)
    {
        return mapOverlays.get(i);
    }

    @Override
    public int size()
    {
        return mapOverlays.size();
    }

    @Override
    //Event when a place is tapped
    protected boolean onTap(int index)
    {
        OverlayItem item = mapOverlays.get(index);
        AlertDialog.Builder dialog = new AlertDialog.Builder(context);
        dialog.setTitle(item.getTitle());
        dialog.setMessage(item.getSnippet());
        dialog.show();
        return true;
    }

    public void addOverlay(OverlayItem overlay) 
    {
        mapOverlays.add(overlay);
        this.populate();
    }   
}
  • 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-07T04:15:22+00:00Added an answer on June 7, 2026 at 4:15 am

    Have a look at this project – balloon itemized overlay. It is using own class extending FrameLayout to show balloons.

    So if you want to modify your code put this into your onTap method to display a TextView above taped item

    TextView text = new TextView(context);
    text.setText(item.getTitle());
    MapView.LayoutParams params = new MapView.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT,
        ViewGroup.LayoutParams.WRAP_CONTENT, item.getPoint(), MapView.LayoutParams.BOTTOM_CENTER);
    params.mode = MapView.LayoutParams.MODE_MAP;
    mMapView.addView(text, params);
    

    I think this code is simple and easy to understand and you can improve it accordingly to your needs. To make it work you have to pass instance of MapView to constructor of your overlay and save it to private variable mMapView.

    private MapVeiw mMapView;
    
    public CustomItemizedOverlay(Drawable defaultMarker, Context context, MapView mapView) {
        this(defaultMarker);
        this.context = context;
        this.mMapView = mapView;
    }
    

    And don’t forget to add MapView as one of parameters when you call new CustomItemizedOverlay().

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

Sidebar

Related Questions

I have made a few simple apps on android, and thought it was time
I have a simple word jumble game. I made the jumble already, but now
I have already made an algorithm for the problem but it still got a
I have an XDocument class with the XML contents already made. I basically want
I have a problem creating and executing a JAR file. I have already made
I have been given the tasks of speccing a mobile application, which will need
I made a simple application in jQuery mobile annd HTML 5 according to the
What I'm trying to achieve is simple. Now there's an extension already made called
I've made a simple app, where I have a list of songs. The user
it's been some time now, since I started reading about android. I've already made

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.