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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:23:11+00:00 2026-06-08T15:23:11+00:00

In My Android map application, I have some cluster icons. whenever the cluster icon

  • 0

In My Android map application, I have some cluster icons. whenever the cluster icon is pressed i want to display a popup infobox with text and button. If we pressed the button, it will lead to next activity.

private void drawInfoWindow(Canvas canvas, MapView mapView, boolean shadow,
            int x, int y) {

        if (isSelected_) {

                Point selDestinationOffset = new Point();
                mapView.getProjection().toPixels(cluster_.center_,
                        selDestinationOffset);

                // Setup the info window with the right size & location
                int INFO_WINDOW_WIDTH = 125;
                int INFO_WINDOW_HEIGHT = 25;
                RectF infoWindowRect = new RectF(0, 0, INFO_WINDOW_WIDTH,
                        INFO_WINDOW_HEIGHT);


                infoWindowRect.offset(x, y);

                // Draw inner info window
                canvas.drawRoundRect(infoWindowRect, 5, 5, getInnerPaint());



                // Draw the MapLocation's name
                int TEXT_OFFSET_X = 10;
                int TEXT_OFFSET_Y = 15;

                canvas.drawText(cluster_.number+" Incidents", x + TEXT_OFFSET_X, y
                        + TEXT_OFFSET_Y, getTextPaint());
            }
        }

This shows only a small textview like popup window. But i want to display a popup infobox with text and button. Please provide me the best way….

Thanks…

  • 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-08T15:23:14+00:00Added an answer on June 8, 2026 at 3:23 pm

    You can use a custom layout xml file to create a overlay on mapview, instead of using canvas.

    1. Create a xml file for your overlay(I use overlay_pin_layout.xml here). For example, a linearlayout which has a textview on the top and a button on the bottom.

    2. Add this overlay to where you want.

      // Inflate your overlay from xml file

      View overlayPin = getLayoutInflater().inflate(R.layout.overlay_pin_layout, null);

      // Set the textview

      ((TextView)(overlayPin.findViewById(R.id.textview_overlayerpin))).setText(YOUR_TEXT);

      // set button touch listener

      ((Button)(overlayPin.findViewById(R.id.button_overlayerpin))).setOnLongClickListener(
      new View.OnLongClickListener() {

                          @Override
                          public boolean onLongClick(View v) {
                              // Do something on button click
                              return false;
                          }
                      }
                  );
      

      // add your overlay on mapview by geopoint

      overlayPin.setLayoutParams(new MapView.LayoutParams(LayoutParams.WRAP_CONTENT,
      LayoutParams.WRAP_CONTENT,
      new GeoPoint(YOUR_LAT, YOUR_LON),
      MapView.LayoutParams.BOTTOM_CENTER));
      mapView.addView(overlayPin);

    For a pop-up like animation , try this one.
    Create a anim folder in res, if you do not have one.
    Create a xml with the code below in anim folder. I call it animation_pop_up.xml.

    <?xml version="1.0" encoding="utf-8"?>
    <set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:fromXScale="0.0"
        android:toXScale="1.0"
        android:fromYScale="0.0"
        android:toYScale="1.0"
        android:pivotX="50%"
        android:pivotY="50%"
        android:duration="500"
        android:repeatCount="0"
        android:repeatMode="reverse"
        android:interpolator="@android:anim/accelerate_interpolator"
        >
    </scale>
    <alpha
        android:fromAlpha="0"
        android:toAlpha="1"
        android:duration="500"
        android:repeatCount="0"
        android:repeatMode="reverse">
    </alpha>
    </set>
    

    When you add overlayPin on mapview, play the animation.

    Animation animation = AnimationUtils.loadAnimation(mainActivity.getApplicationContext(),
                        R.anim.animation_pop_up);
    overlayPin.startAnimation(animation);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to display google map in Android ,i have map API even map
I have created a map application for android smart phones and I want it
I have made a application in android with map view and I want to
Within my Android application I display some data within a map. To do that
I want to display Satellite Map view in Android without Road/city/country label overlapped on
My application have to load some points from internal sqlite database of android, and
I have developed an android application in which some OK button (soft key) is
I have a map application using an in-house map engine on Android. I'm working
In my android application i have used the google map. I have using android
I want to develop an application in iPhone and Android both which can display

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.