I have already posted my query here, but unfortunately, not getting the required support for this simple query.
I am using a progressbar widget in my application to show the download progress.
In the current state, I am able to manually move the slider back and forth while download is progressing. How can I prevent the manual moving of progressbar, instead it works only based on
progressbar.setProgress(progressbar.getProgress() + 1024); -- currently this works perfect, but I need to prevent the manual moving of progressbar during download.
There is example code on the Android developers website:
https://developer.android.com/reference/android/widget/ProgressBar.html
Have you followed that? I doubt the progress bar is scrollable by default, it would be a seek bar then
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 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 a program that copies a file to the sd card. The program takes a while to run, and now it just freezes while the file is being copied.
I saw some other programs that have a animation of a wheel spinning in the center of the screen while the file is being down loaed.
I tried to google spin control, but this brought up animation about a selector control using spinning wheels.
Is this feature built into the android?
Use a ProgressBar widget with indeterminate="true". You can use a ProgressDialog, read http://developer.android.com/guide/topics/ui/dialogs.html
Also, learn about threads, as you should be doing your file save in a background thread. http://developer.android.com/guide/components/processes-and-threads.html
You should use an AsyncTask to download the file. This will prevent your UI from freezing, and also easily allows you to show progress information if you want. If you want to let it download in the background, and let the user continue using the app, that's doable as well.
You can find an AsyncTask in one of my open source projects that downloads a file and shows the progress information using a progress bar here. You can change the style of the progress dialog to suit your needs.
I'm assuming you're using some sort of AsyncTask to download it?
If this is the case you can make an indeterminate progress bar start spinning right before you call task.execute() and then in onPostExecute() you can set the progress bar's visibility to view.GONE
here is an example on progress bars: http://codehenge.net/blog/2011/06/android-development-tutorial-progressbar-example/
I am looking for a class that implement a horizontal slider bar like the one on the "lock" screen. In other words, user must slide the bar from left to right to run an activity. Thank you so much for your time.
Internally, Android uses a class called SlidingTab for this (the main lockscreen is in a file called LockScreen.java. As with all Android core code, it's Apache licensed. At the risk of sounding like a broken record here on SO, download the AOSP and read through the code whenever you have a "how did the Google folks do x?" type of question (or even when you don't; there's some good stuff in there).
Maybe a Seek Bar might help you towards a solution to your problem. If this works for you let me know, because i am interested in a solution to that as well. Thanks
The link is the developer document for that feature.
Here is an example that extends a horizontal ProgressBar so that the user can set the "progress" by sliding left/right. It's actually quite straight forward, it just overrides the onTouchEvent() method, does some minor mathematics and sets the progress value depending on the TouchEvent's X coordinate.