ProgressDialog.show(MainActivity.this, "", "Загрузка. Пожалуйста подождите...", true);
возвращает ProgressDialog. progressDialog = ProgressDialog.show(MainActivity.this, "", "Загрузка. Пожалуйста подождите...", true);
For example, a service might handle network transactions, play music, perform file I/O, or interact with a content provider, all from the background.
Note: The Alarm Manager is intended for cases where you want to have your application code run at a specific time, even if your application is not currently running. For normal timing operations (ticks, timeouts, etc) it is easier and much more efficient to use Handler.