How to show the progress bar onViewCreated in Fragment? - android

I'm a very new in android. It is currently making apps using TensorFlower on Android. I use textureview in Fragment, and the screen shows a white screen while the learning file of tensorflow loads. The time is about five seconds. I want to show the progress bar during loading the time. I want you to tell me. Thank you.

Related

How to create loading screen in android?

I am developing an android app, in which I need a loading screen like the one given below. In this screen I want a custom progress bar and a loading text in the centre of the screen, and the background effect should be blurred. When the loading starts, the user should not be able to perform any action.
How can I create this type of loading screen?
#Ganpat Kaliya
Please check Transparent progress dialog on Android
Just set
setTitle(Loading...);
I would suggest you to use the custom Progress dialog. The purpose of using progress dialog is that as you wanted the screen to be blur, so when ever you would bring Progress dialog to front the activity would get blur , additionally it is highly customize able , you can do what you want.
A very useful explanation is here and here. please check them out and apply.

Hide Progress Dialog from background-fragment

I'm encountering the following problem. I implemented a navigation with tabs and viewpager to swipe through my fragments. This is working fine so far.
But the fragments are all loading data via Async Task and for that they are showing an progress dialog. Which is self is also working as it should. My problem is, that because of the Viewpager not only the actual fragment is loaded but also the one next to it. So I see wrong progress dialog.
Is there any way, to achieve a behavior that the progress dialog stays visible for it's fragment (so, that the user is informed, when he moves to the next tab before the async task finished loading) but not anywhere else?
Hope it's clear, what I wanted to say.
Thanks for your help.
Best wishes
The progress dialog can be a "dialog" that hangs out in front of everything, or it can be a View that sits in place. So, my advice would be to make either a full screen (or just partial screen) layout that sits in your fragment and displays the progress dialog. It will move aside with the rest of the fragment if the user moves to a different fragment. If you set it at the top Z level, make it full screen and capture all taps to it (and swallow them so they don't cascade down into the layouts beneath in the z-order) I believe you'll have exactly what you're describing as your desired result.
The key is not to use ProgressDialog dynamically in code, but rather just the View version of it that you just place in your XML.
Edit:
I'm talking about one of these...
<ProgressBar
android:id="#+id/progressBar1"
style="?android:attr/progressBarStyleLarge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>

How to show a progress bar inside an Image View while uploading an image in Android?

Currently, when I am uploading an Image in Android, the entire screen goes blank and the image loads after some time. I would like to change that and make sure that there is just a progress bar inside the ImageView which shows how much of the image upload has been done(Something similar to Whats'app) and then display the image once the upload is done. How do I do that?
Edit:
I do know how to use progress bar, but the problem I face here is that my ImageActivity is a separate activity and I am calling it from a different activity to upload the image. The activity from where I am calling from is the one that should display the progress bar. Thus, not able to do that. Not able to get the progress from the other activity.
try below link for upload the files to show the progress bar!
Upload progress bar in android?
Thanks...!

Appcelerator titanium - Splash screen with progress bar

I'm trying to setup a custom splash screen that comes up when my ios & android app, built with titanium, loads up for the first time.
The screen would be similar to the default appcelerator splash png that shows up when the app is launched on the emulator.
The screen would have
1. Custom background
2. App logo
3. Progress bar that animates from 0 to 100%
Any idea how this can be done?
There is no way to put a progress bar on the "Splash screen".
The only way is to have your first window set it's background to the same as the splash screen image with a progress bar on it. The do your long running start up and close the window when done. Generally, however, it is bets not to have long running start ups ;)
I don't know about Android, but on the iPhone you can't add anything to the splash screen (Default.png), you can however add a UIImageView subview to the key window so that when the splash screen goes away, the user can't tell, and then you can add a progress bar to THAT. If you code your program to load most of it's contents afterwards you could have some form of progress bar on the 'splash' screen..
I use the same method to make the splash screen appear to "fade away" when my apps load.

Loading screen in Android

What's the best way to create a reusable loading screen in Android? The loading screen should have a background image and a loading indicator.
Should I use a separate activity?
The best way is using a separate activity with a SurfaceView that shows the image. Then, you can create an overlay that contains the ProgressBar.
You just could define your own dialog with custom layout. You would handle what happens if your progress screen gets cancelled (pressing back button). You could also prevent it from happening too.
By using an standard dialog you take adavantage of nice efects (background activity darkening with upgrades) and prevents user from interacting with background activity while it is on.

Categories

Resources