Although a
ProgressDialog
is an
AlertDialog
,
is not created with an
AlertDialog.Builder
.
There is no
STYLE_VERTICAL
,
only
STYLE_HORIZONTAL
and
STYLE_SPINNER
.
See Android’s
tutorial.
The main thread creates a
ProgressThread
to move the
ProgressDialog
and brighten the
background
of the
LinearLayout
from black to white.
When the level of progress reaches 100,
the main thread causes the
ProgressDialog
to break out of its
for
loop.
This causes the
ProgressThread
to reach the end of its
run
method, which terminates the thread.
The background becomes white suddenly because the background is dimmed down
while the dialog is displayed.
AlertDialogSamples.java
:
case
DIALOG_PROGRESS
.alert_dialog.xml
strings.xml
STYLE_HORIZONTAL
to
STYLE_SPINNER
.
The ring never stops rotating,
so the screenshot caught the hardware in the process of repainting the screen.
Increasing the number of milliseconds passed to
sleep
didn’t help at all.
max
,
keep the dialog visible for three seconds.