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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:19:52+00:00 2026-06-17T15:19:52+00:00

I implementing the new Google Maps Android API right now within my app, and

  • 0

I implementing the new Google Maps Android API right now within my app, and there are a few things that I want to do when the map has loaded such as moving the map to the current location and displaying a marker there and enabling certain overlays like the satellite view. However, I am running into NPEs when I try to access the Mapview’s getMap() because the GoogleMap object isn’t ready.

Is there a way to detect when a MapView’s GoogleMap is ready? I found CommonsWare’s suggestion for dealing with the SupportMapFragment and detecting when getMap() will not get null, but what would the equivalent event by for a MapView?

CommonsWare’s suggestion for SupportMapFragment: How do I know the map is ready to get used when using the SupportMapFragment?

This seems kind of broken that there is not a way to determine when the GoogleMap object is ready so that we can do all these setup things.

  • 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-17T15:19:53+00:00Added an answer on June 17, 2026 at 3:19 pm

    To use the MapView directly you need to make sure you forwarding the Activity lifecycle methods through to the MapView.

    E.g. to set it up, you’d do this in your onCreate()

     @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.raw_mapview_demo);
    
        mMapView = (MapView) findViewById(R.id.map);
        mMapView.onCreate(savedInstanceState);
    
        setUpMapIfNeeded();
    }
    
    private void setUpMapIfNeeded() {
        if (mMap == null) {
            mMap = ((MapView) findViewById(R.id.map)).getMap();
            if (mMap != null) {
                setUpMap();
            }
        }
    }
    

    The code is taken from Google’s sample code that is included with the Play Services lib. You also need to route onDestroy(), onResume(), and onPause().

    FYI you need to check for a null pointer for both the MapView and MapFragment as the user may not have Google Play Services installed. If it isn’t installed the user should get a prompt to install the APK and then you can return to this Activity.

    Hope that helps.

    Ryan

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

Sidebar

Related Questions

I'm implementing an XMPP client for Google Talk that is using the relatively new
I'm implementing a system that require access to Google Places JS API . I've
EDIT: Yields that there is already new PHP framework written as extension. http://code.google.com/p/yafphp ,
I have been writing a chat app for android. I am implementing Google talk
I am implementing an Android App that sends a message to PHP server then
I was having problems earlier implementing in-app billing for android. I have fixed that
i am implementing google maps on my website, but i want to remove satellite
i am implementing a splitview using the new fragment from Google (Android 3). when
I'm implementing Google Maps into a new project and one page should return a
Is there any good documentation on implementing new refactorings in Eclipse? Specifically, I'd like

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.