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!