showing ProgessDialog when loading a MapView

1227
3
07-29-2012 05:14 AM
Chrisvan_Aart
New Contributor
I am looking for a way to show the progress dialog when loading a MapView.

MapView map = new MapView(this, url, "", "");
 

Thanks
0 Kudos
3 Replies
GuyNahmani
New Contributor
Hi,

I did something like that i the past.

// Declare your loading map with status recognition in getUnits() function.
viewUnits = new Runnable(){
            @Override
            public void run() {
             getUnits();
            }
        };
        
        //It'll stope the progress only after finish with getUnits(); there you'll do the map's status check.
        Thread thread =  new Thread(null, viewUnits, "MagentoBackground");
        thread.start();
        m_ProgressDialog = ProgressDialog.show(UnitsModelListViewActivity.this,    
              "Please wait...", "Retrieving data/Loading ...", true);


Hope it'll help you...
Enjoy!
0 Kudos
NicoTek
New Contributor III
@guy_nach

Could you explain a bit more to me what your code does? I'm also interested in implementing something similar.
When I add dynamic layers to my mapview the take a bit to show because my server is not that fast, so there I would like to show a progress bar.

I don't fully understand how to implement your solution, but would like to use it.

Thanks!

@2cm
what did you end up doing?
0 Kudos
SimonKlein
Occasional Contributor
If I understand you correctly you can just create and show a progressdialog when you add the layer and disable it in the onstatuschangedlistener of your mapview when "layerloaded" is called with the id/name/etc. of your added layer.
0 Kudos