Maybe my English is poor but I really cannot figure out what the "indeterminate" means in this context:
Android Development → ProgressDialog.isIndeterminate()
It means the "loading amount" is not measured.
From wiktionary:
Indeterminate: Not accurately determined or determinable.
It basically just means you're unsure how long the action will take so you cannot say for example something is 50% done.
This normally just means the progress will be displayed as a constantly moving loading bar rather than a percentage or the like.
Basically when setProgressStyle(ProgressDialoge.STYLE_SPINNER) is taken then setIndeterminate() will be true because a circle(Spinner) will rotate, which shows that "do not know how much time it is going to take". When take ProgressStyle(ProgressDialoge.STYLE_HORIZANTAL) we will take setIndeterminate() as false since it take a value/percentage bar like how much percentage it was completed with setProgress(value).
In simple language we can say when the amount is not determined means we don't know how much it gonna be to be completed or loaded fully..!!
Change the indeterminate mode for this ProgressDialog. In
indeterminate mode, the progress is ignored and the dialog shows an
infinite animation instead.
Note: A ProgressDialog with style STYLE_SPINNER is always
indeterminate and will ignore this setting.
Blockquote
For illustration, the progress animation keep loading from left to right and then repeat automatically without user interaction(which setProgress) when indeterminate set to true.
Reference here.
Related
This question already has an answer here:
How can I display a Progress at start up application in android
(1 answer)
Closed 5 years ago.
I have a heavy user interface that can delay the application load. I want to show an preloader before the UI of activity loaded. note that my ui is in xml file
EDIT:
If you want to load 10 tabs in a view pager, use a FragmentStatePagerAdapter which only loads neighboring tabs(default behavior).
If the heavy UI you specify is only the UI elements, then the app must freeze while loading it. So you'd better show a non-cancelable dialog(without animation) with loading message and after a few moment (like 200ms) load up your UI and explicitly dismiss the dialog.
But if the heavy stuffs is not just UI, maybe some calculations or image processing, just do it in a background thread while showing a dialog with progress and cancel the dialog when the task is done.
#Hassan according to me if on clicking the launcher icon if it takes sometime for your application to render the first screen(perhaps giving a black screen in between). This needs to be corrected in your application.
On the contrary if your applications main screen requires population/retrieval of certain resources for effectively engaging the users, You can possibly do something like a splash screen(outdated) where you do all "population/retrieval" and then simply pass data to your heavy UI.
Now regarding the progress bar if this fetching of data is small, you can give an indeterminate "custom"(some moving animation that would suite your app) progress bar,else if its something like a download you can easily track its progress and show in a horizontal progressbar
You sure can! You are describing a preloader. Here is a nice example of one https://github.com/rtheunissen/md-preloader
You'll have to add more info to your question to get a specific answer, but there are a few basic principles.
You make your life a lot easier if you use a preloader which doesn't show progress of the load, it just goes round and round, because the speed of some load processes can't be measured.
If its a data-load which is taking the time (such as a call to an API), you might want to set a variable for "loading" to true at the top of your script, then when the data has resolved, set it to "false". In your view, have a state or a conditional element which hides / unhides the preloader.
If lots of images are slowing down the page, you might want to look into "lazy-loading" or using "infinite scroll" to only show content when the UI needs to display it on screen.
Thats all the info I can give without more information on the code you have so far. Hope that helps!
I was going through developer site of android and I found a class named ContentLoadingProgressBar. By seeing this class I come up with some questions in my mind. It would be great if someone answers my questions.
What is the difference between Normal ProgressBar and ContentLoadingProgressbar?
What is the practical usage of ContentLoadingProgressBar?
Can we show/hide this progressbar according to our requirement?
How can I custom style this progressBar?
Thanks for your help in Advance. It would be great if someone explain it using codes and examples. Thank you.
Here are my answers!
What is the difference between Normal ProgressBar and
ContentLoadingProgressbar?
ContentLoadingProgressbar waits a minimum time to be dismissed before showing using hide() like with-in 0.5 seconds.So even the show() gets called this can be dismissed before it appear on the screen.
What is the practical usage of ContentLoadingProgressBar
It prevents very fast flickering stuff that you might see with "naive" implementations.
Can we show/hide this progressbar according to our requirement
Yes
How can I custom style this progressBar
<android.support.v4.widget.ContentLoadingProgressBar
android:id="#+id/address_looking_up"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:visibility="visible" />
replace style with android:theme https://stackoverflow.com/a/38282149/5188159
Let's say you want to show a ProgressBar for some background operation that may take less than 500ms or more than 5 seconds.
You call progressBar.show() Then you start your background operation.
If your background operation is over within 500ms. Then you call progressBar.hide()
Now the user will see a flicker of the progress bar appearing and disappearing within a fraction of a second.
Introducing ContentLoadingProgressBar:
When you use this progressbar, then it will wait for a minimum time before showing the progress dialog. Which means if the time between show() call and hide() call is less than that minimum time, then there won't be any dialog to be shown to the user.
According to the docs:
ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be dismissed before showing. Once visible, the progress bar will be visible for a minimum amount of time to avoid "flashes" in the UI when an event could take a largely variable time to complete (from none, to a user perceivable amount)
This clearly mentions it's no different from a regular ProgressBar . Furthermore, this is a UI tweak to be precise, i.e. ContentLoadingProgressBar wouldn't show up if hide() is called in less than 0.5s after executing show(), thus preventing from quick flickering in the UI.
One note of using ContentLoadingProgressBar for recyclerview items. I have a scenario in which an arbitrary RV item can download something on clicked and shows indeterminate progress until completion. It appears to be impossible to use the benefits of CLPB in such case because of maintaining internal delays in CLPB when show()/hide() it: reused views may have inconsisted progress state (progress disappears or become infinite depending on reused holder view state). Thus i was forced to return to old good setVisibility:
public void onBindViewHolder(final RecyclerView.ViewHolder holder, int position)
...
if (item.isLoading()) {
//holder.progressBar.show();
holder.progressBar.setVisibility(View.VISIBLE);
} else {
//holder.progressBar.hide();
holder.progressBar.setVisibility(View.INVISIBLE);
}
I have a vocab building app with different vocab categories displayed in a list view. I want to have a circular progress indicator for each category that shows how familiar the user is with the vocab stored in it. I know that Android has a built-in Progress Bar. The design is what I'm looking for, however, it appears that the progress bar is running continuously by default. Whereas in my case, I just want it to be static and updated only when the activity that displayed the category items are (re)opened. So to summarize again, the main difference is that the progress bar I'm looking for isn't dependent on a process that is currently running but instead from an SQLite database where I stored information on how familiar the user is with each vocab.
I have searched online and I wasn't able to solve this problem since progress bar is usually implied to be dependent on a running process.
Thank you so much for any help in advance!
The Android ProgressBar is designed to show the progress of a process, yes, you are correct. They can be either determinate (they go from beginning to end... like a BAR), or indeterminate (they go round and round... like a CIRCLE). Circular progressbars are indeterminate and therefore do not communicate progress per-se, only that there is something in the process of "progressing" and not finished yet.
You say you want to use this widget to communicate to the user what their PERSONAL progress is in a given area.
If you insist on using the ProgressBar widget, then you would need to use a determinate one (horizontal)...
But you do not need the progress bar widget... just make your own indicator or some kind... like
1) Using views/animations, like create a view space and tell it to fill 60%, 20%, whatever...
2) make your own set of bitmap files (say, 5 of them representing 0%, 25%, 50%, 75%, 100% on a circular progress bar)... and swap them out depending on the users progress.
This seems like it should be a simple question, but for some reason I haven't come up with an obvious answer yet:
I have a horizontal progress bar displayed by my app while it does some work in the background. There are a finite amount of steps in this process, so I display actual progress rather than using an indeterminate progress bar.
However, there are occasionally steps in this process that take a very long time, so the progress bar is stationary for a while.
I could update the progress at a finer resolution, but I'd rather have the progress bar "pulse" or show some other constant animation just so that the user can see it is still working. I assumed Android would have this built in without me having to do much work, since it's such a common UI feature, but I can only seem to get this to work if I use an indeterminate progress bar.
Is there an easy way to do this, or do I have to write some kind of custom animation?
I have an AlertWindow that has input fields for registration purposes (looks similar to VPN settings in ICS). The form requires network input to be validated, so it can take a bit of time - and I'd like to add a progress meter (actual progress won't be known).
I'm not sure what is the best way to go about it. I can put one into the ActionBar, but the AlertWindow dims out the whole screen, including the ActionBar when it comes up. Other ways include making a giant progress spinner on top of the whole activity, but I don't like how that would look.
Perhaps I won't need one, and just disabling & changing the text on the register button to 'checking...' or some sort would do?
Any input is welcomed.
I've went ahead and gave the button a different text while it is doing its work.
There is usually an 'indeterminate' state for progressbar controls.
Check this MSDN guideline for different uses of progress bars.