I need progress, not a dialogue of progress

I want to show the progress in my application while loading data. I have activity and moving from one activity to another. I am parsing some XML data, so until the parsing is complete, I want to show the effect of looping.

+19
android progress
Mar 10 '11 at 12:19
source share
7 answers

You can use the undefined ProgressBar for a looping effect. Here's how you do it in XML:

<ProgressBar android:indeterminate="true" android:layout_width="50dp" android:layout_height="50dp" android:id="@+id/marker_progress" style="?android:attr/progressBarStyle" android:layout_gravity="center_vertical|center_horizontal"/> 

You can change the height and width as you want. When you are finished loading, you can change its visibility to View.INVISIBLE or View.GONE

+28
Mar 10 2018-11-11T00:
source share

You need to create an xml animation file in the res / anim folder and call startAnimation in your ImageView when loading data and stopAnimation when you stop loading data. And set the image loading in ImageView, for example:

loading http://bigod26.com/pics/loading.png

This id code for XML animation of circular animation

 <?xml version="1.0" encoding="UTF-8"?> <rotate xmlns:android="http://schemas.android.com/apk/res/android" android:fromDegrees="0" android:toDegrees="360" android:pivotX="50%" android:pivotY="50%" android:repeatCount="infinite" android:duration="1200" android:interpolator="@android:anim/linear_interpolator" /> 
+17
Mar 10 2018-11-11T00:
source share

Insert this between two view tags

 <ProgressBar android:id="@+id/loading_spinner" style="?android:progressBarStyleLarge" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> 
+4
Mar 22 '13 at 17:03
source share

Why not use the progressbar user interface [/ p>

 myProgressDialog = ProgressDialog.show(ListingPage.this,"Please Wait", "Loading Date", true); 



Dan

+3
Mar 10 '11 at 12:25
source share

Use AsyncTask to download and parse:

  /** * Background task that fetched the content from server and parses the content. */ private class BackgroundLoadingTask extends AsyncTask<InputStream, Void, Boolean> { @Override protected void onPreExecute() { // show the progress bar Activity.this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); Activity.this.requestWindowFeature(Window.PROGRESS_VISIBILITY_ON); } @Override protected Boolean doInBackground(InputStream... params) { // try to load XML from HTTP server and parse return true; } @Override protected void onPostExecute(Boolean parsingError) { // hide the progress bar Activity.this.requestWindowFeature(Window.PROGRESS_VISIBILITY_OFF); } } 
+2
Mar 10 2018-11-11T00:
source share

As in the progress dialog box, use the animation instead with the async task and just make it visible during the pursuit and hide it again in the message.

+1
Mar 10 2018-11-11T00:
source share

To expand a bit on trgraglia's answer, you can create an uncertainty indicator (behavior: loop) and set the visibility to false. During AsyncTask preExecute (), make it visible, and during AsyncTask onPostExecute (), return it to invisible (provided that you stay at the same event or in case you need to). This eliminates the need to create animations.

+1
Nov 25
source share



All Articles