Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how get the progress status of loading mapview in android?

while the map is in loading state i want to put a progressbar at the center of mapview.

how to get the progress?? and how to do??

give me some example..

thanks.

like image 299
Praveen Avatar asked Oct 25 '22 20:10

Praveen


2 Answers

I don't think there is any reasonable way of doing it. Note that Google isn't doing this either in their map applications. It is pretty clear just looking at the page to see if tiles are still loading, so I don't think there is actually any need to put in a progress indicator.

The MapView has a method canCoverCenter() which can tell you if the center tile is available, but there is nothing for the rest of the tiles.

like image 133
Heikki Toivonen Avatar answered Nov 15 '22 06:11

Heikki Toivonen


Take a look at GoogleMap.OnMapLoadedCallback

Callback interface for when the map has finished rendering. This occurs after all tiles required to render the map have been fetched, and all labeling is complete. This event will not fire if the map never loads due to connectivity issues, or if the map is continuously changing and never completes loading due to the user constantly interacting with the map.

Usage example:

/**
 * Acquire a non-null instance of the GoogleMap.
 */
mMapView.getMapAsync(new OnMapReadyCallback() {
    @Override
    public void onMapReady(GoogleMap googleMap) {
        googleMap.setOnMapLoadedCallback(new OnMapLoadedCallback() {
            /**
             * Called when the map has finished rendering.
             * This will only be called once.
             * You must request another callback if you want to be notified again.
             */
            @Override
            public void onMapLoaded() {
                //TODO: Hide ProgressBar
            }
        });
    }
});
like image 34
Markus Rubey Avatar answered Nov 15 '22 05:11

Markus Rubey