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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T12:32:21+00:00 2026-06-08T12:32:21+00:00

I have a MapView that works properly and is setup, the overlay items being

  • 0

I have a MapView that works properly and is setup, the overlay items being drawn (when simply referenced as a drawable) work just fine. However, each drawable item needs to include a numerical value on it (e.g, overlay item 1, needs to display a #1 on it). I created the layout style R.layout.map_bubble_standard. I’m trying to convert that view into a bitmap, and that bitmap into a drawable to be displayed on the map. However, when the map loads, nothing shows up. Here’s what I’m doing…

        LayoutInflater inflater = (LayoutInflater) _context.getSystemService(     Context.LAYOUT_INFLATER_SERVICE );
        LinearLayout bubbleView = (LinearLayout)inflater.inflate(R.layout.map_bubble_standard, null);

        bubbleView.setDrawingCacheEnabled(true);
        bubbleView.buildDrawingCache();

        //drawable = _context.getResources().getDrawable(R.drawable.map_pin_48);
        drawable = new BitmapDrawable(_context.getResources(), bubbleView.getDrawingCache());
        bubbleView.setDrawingCacheEnabled(false);

    OverlayItem oi = _overlays.get(whichOne); 
    oi.setMarker(boundCenterBottom(drawable));

My code completes the method just fine, but nothing is drawn on the map. Can anyone help determine what I’m doing incorrectly?

[Edit] – Resolved

I used a another link that I found, that offered advice for fixing this:
Here

Hopefully this can help someone else out in the future as well. For reference, I also moved the inflater for the view and the inflater object itself into the default constructor for my itemized overlay class.

_bubbleLayout.setDrawingCacheEnabled(true);

        _bubbleLayout.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), 
                    MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
        _bubbleLayout.layout(0, 0, _bubbleLayout.getMeasuredWidth(), _bubbleLayout.getMeasuredHeight()); 

        _bubbleLayout.buildDrawingCache(true);
        Bitmap b = Bitmap.createBitmap(_bubbleLayout.getDrawingCache());
        _bubbleLayout.setDrawingCacheEnabled(false); // clear drawing cache 

        //drawable = _context.getResources().getDrawable(R.drawable.map_pin_48);
        drawable = (Drawable) new BitmapDrawable(_context.getResources(),b);



    OverlayItem oi = _overlays.get(whichOne); 
    oi.setMarker(boundCenterBottom(drawable));
  • 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-08T12:32:22+00:00Added an answer on June 8, 2026 at 12:32 pm

    Not sure if this is right, but according to the documentation:

    To benefit from the cache, you must request the drawing cache by calling getDrawingCache() and draw it on screen if the returned bitmap is not null.

    To me that means you must have drawn the View once on the screen before you get anything back. If its never been actually drawn then it has no cache to pull from. Are you making this visible on the screen first?

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

Sidebar

Related Questions

I have an application that uses the mapview-overlay-manager code to draw map markers on
I have a MapView that will contain alot of overlays. For this i've extended
I have a simple mapview that has the following viewdidload method and didupdate to
I have an app that has a mapview, and it shows 20 pins (from
I have a MapView where Drawable markers are placed with a limit set to
I have a mapview, with the MyLocationOverlay, and other overlays. MyLocationOverlay is drawn under
I have a strange problem using a MapView in Android. It works fine until
I have a mapView that has annotation added through JSON (feed is stored in
I have a MapView with a toolbar button that when pushed adds overlays to
I have a method that works to move the the map so that it

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.