Asynctask in the process, we will generally use a rotating "chrysanthemum" to show the current user's current progress, generally, we do not use the system comes with the ProgressDialog, but the design of their own animation to achieve, when the chrysanthemum rotation, do not allow users to click on the page, So put this chrysanthemum on the alertdialog custom page, if the rotation process, allowing users to click Other locations of the page, such as search the city, then put this progress picture directly on the page XML the file is ready. Give the turning Chrysanthemum implementation Code :)
first step: Animation Span style= "Font-family:times new Roman" >anim file added rotate_animation.xml
<? xml &NBSP; version = " 1.0 " &NBSP; = " utf-8 " ?>
< rotate &NBSP; xmlns: Android = " http://schemas.android.com/apk/res/android "
android:pivotx = " 50% " &NBSP; = " 50% " &NBSP;
&NBSP;&NBSP;&NBSP, android:fromdegrees Span style= "Color:rgb (0,0,0); Font-family:consolas ">= " 0 " &NBSP; = " -720 "
android:duration="1800"
android:fillafter="true"
android:interpolator="@android: Anim/linear_interpolator"
>
</ Rotate >
Step two: Animate imageview
&NBSP;&NBSP;&NBSP;&NBSP; private &NBSP; void startanimation (View view) {
animation animation = Animationutils. loadanimation (citysettingactivity. this , r.anim. rotate_animation
Animation.setrepeatcount (animation. INFINITE );
Animation.setrepeatmode (animation. RESTART );
View.startanimation (animation);
}
Step three: Add turning chrysanthemum in Asynctask
OnPreExecute () inside
Open animation
startanimation (imgprogress);
OnPostExecute () Inside
Turn off animations
imgprogress . clearanimation ();
Android Development step by step in the process of 52:asynctask custom rotating chrysanthemums