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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:22:13+00:00 2026-05-14T00:22:13+00:00

I am working on an Android app that utilizes the Google Maps API MapView,

  • 0

I am working on an Android app that utilizes the Google Maps API MapView, MapController, MapActivity, and ItemizedOverlay. I am basically trying to recreate certain functionalities of the Maps app (damn Google for not providing speech bubbles—for lack of a better name—for items!), particularly those speech bubbles.

I have an invisible XML structure for the speech bubble in the XML layout file containing my MapView. The first time I show a speech bubble I grab that XML and remove it from it’s current parent, applying some ItemizedOverlay.LayoutParams to it, and add it to the MapView as an Overlay. I position it above the item that was selected, fill it with the proper text, then set it to visible.

This all works great. The goal here, though, is to also automatically animate the map to reveal any parts of a speech bubble that may be off-screen when it opens. So I’m trying popup.getWidth() (popup is the instance of my LinearLayout that is the speech bubble) after I do all the manipulation to the bubble, even after I display it to the user. Problem is, popup.getWidth() is returning me the width of the previously displayed popup, not the currently displayed one. I can’t figure out why this would be happening if I’m fetching the width after I set it to visible with its new dimensions (which, by the way, are relative when I’m setting them with LayoutParams: fill_content for both width and height).. I have even tried forcing both the MapView and the “popup” to invalidate() before trying to fetch the width.

Any ideas why this may be happening? How can I force the View to settle into its new dimensions before trying to fetch them?

Thanks!
Nick

  • 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-14T00:22:13+00:00Added an answer on May 14, 2026 at 12:22 am

    Calls like addView() and invalidate() do not happen immediately. You can think of it as if those calls create messages that go on a message queue. When you return from whatever callback you’re in (e.g., onTap()), the main application thread goes back to its normal role of popping messages off that queue and processing them. Hence, the changes you are making will not take immediate effect, but only after you return.

    What you can try doing is putting your logic that needs the width in a Runnable and post()-ing that Runnable. That will put it in the queue, presumably after your addView() and related stuff. At that point, when that Runnable is run, you should be able to get the correct width.

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

Sidebar

Ask A Question

Stats

  • Questions 352k
  • Answers 352k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer IF (condition) EXEC ('ALTER PROC ...') ALTER/CREATE PROC must be… May 14, 2026 at 7:33 am
  • Editorial Team
    Editorial Team added an answer If I understand correctly, you've got an instance of SecondViewController… May 14, 2026 at 7:33 am
  • Editorial Team
    Editorial Team added an answer use urllib2 instead if you don't want to handle reading… May 14, 2026 at 7:33 am

Related Questions

With today's modern mobile phones, is it still worth programming the mobile version of
I am quite new to Android and Java. Before I was working with C++
I am working on an ASP.NET project which is physically located at C:\Projects\MyStuff\WebSite2. When
I am working on an application for college music majors. A feature i am
I am working on an application that installs a system wide keyboard hook. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.