I have edittext and button to insert data,when i click the button i am hiding the button and edittext and showing a ProgressBar.I am using AsyncTask to insert data in sqlite database, but the problem is, While performing background task,the ProgressBar is not animating.I am using progressbar with intermediateDrawable.
NOTE: ProgressBar is animating Perfectly in other classes,but when i insert data in database, its showing but not animating.
ProgressBar
<ProgressBar
android:id="@+id/pb"
android:visibility="gone"
android:layout_centerInParent="true"
android:layout_width="100dp"
android:layout_height="100dp"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/viewSpace3"
android:indeterminateDrawable="@drawable/loader_0_1" />
loader_0_1.xml
<rotate xmlns:android="http://ift.tt/nIICcg"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" >
<shape
android:innerRadiusRatio="3"
android:shape="oval"
android:thicknessRatio="8"
android:useLevel="false" >
<size
android:height="48dip"
android:width="48dip" />
<gradient
android:centerColor="#FFFFFF"
android:centerY="0.50"
android:endColor="#0B95B9"
android:startColor="#FFFFFF"
android:type="sweep"
android:useLevel="false" />
</shape>
In preExecute of AsyncTask i am hiding other widgets and showing progressBar pb, using
pb.setVisibility(View.VISIBLE);
In doInBackground, i am inserting data in database using cursor
In PostExecute, i am hiding progressBar and showing other widgets
pb.setVisibility(View.GONE);
Is that a memory or RAM issue that doesn't allow progressBar to Animate while working with Databases...?
Aucun commentaire:
Enregistrer un commentaire