I'd like to start my app and show the main screen instantly. Half of the info on the screen will be loaded form local storage and the other half will be from a web service. Each of these will be on two different fragments. I'd like to display a loading indeterminate progress bar while the data is being fetch from the webservice, similar to how the Google Play Store loads it's app date as shown below by the two states below:
My thoughts on implementing it are as follows:
Load the fragment in with the progress bar & the normal screen (hidden) in one layout. Once the data from the web service has been collected, populate the normal screen, then hide the view group containing the progress bar and show the viewgroup with the data.
Is this best practice? Are the better ways to do it than this?
Thanks in advance.
You can implement it yourself but you can also use a simple library called ProgressFragment
avalaible on github
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 am working on an application that has several states that matter to the user, online vs offline, how far out of date the local application database is, et cetera. I understand that both non-persistent and persistent notifications are available in android, and might be appropriate in this scenario. However, in our organization's iOS application, there is an 'information bar'.
I realize that this is somewhat of a departure from material design. Is this even possible? I'd like to extend the App Bar in some way as opposed to creating a fragment that I add to every activity if possible.
Try any of the following
1) Replace the action bar with toolbar and customize the design on your own and handle it.
2) Create the separate layout file with the above design and then include it in any screen using the tag <include/>
You can do this a custom Toolbar class or with Fragments. For the later option, each activity will have the user information at the top, either as a view or a fragment. The "normal app stuff" will be a FrameLayout which can hold one fragment at a time. See the Fragment tutorials on http://developer.android.com.
There aren't really hooks for extending the toolbar- in fact Google has deprecated a lot of stuff it used to be able to do (such as tabs in the toolbar). Your best bet is to use a custom fragment at the top of every Activity.
Is there any good library or tutorial about how to implement what i call an application tutorial feature.
When a user open some activity for the first time - the activity doesn't stops but some layer is shown above with custom UI and some elements (that are being highlighted) from the activity are still visible.
If my words seem unclear, just look at the first screenshots here:
Like you can see on the first screens here http://www.android-app-patterns.com/apps/app/209
The only library I found is https://github.com/amlcurran/ShowcaseView but it doesn't allow arbitrary ui, afaik.
I work that like this:
Create fragment in activity.
Create style for that fragment (transparent,picture and...).
Create SharedPreference method and save status true when user first time open app ,and show fragment.
Set in onCreate : if (status!=true){ - show fragment -}
my first question here... so sorry for duplicates, but i didn't find an answer at all =(
I'm trying to create an app with 3 pages.
Main page - list of videos
Bookmark page - list with all videos bookmarked
settings page - settings and stuff
I first created it with 3 activities. It runs ok, but i found a problem when creating an asyncTask in Main page to download a video. The progress should appear in a progressBar in bookmark page. I thought about using roboSpice, but it seems more appropriate to use 3 fragments and a main activity (where the download would be made) instead of 3 activities.
So i went to actionBarSherlock, but then, another problem came up. I need a header with 2 buttons and a title. One button would call bookmark page and the other button would call settings.
It doesn't seem right to use actionBarSherlock to create a header by modifying the title, or even removing it, and just use the tabs.
Any ideas of how to implement this?
Examples would be nice!
Searching around i found a way to implement this using broadcast receiver and not using fragments, only activities.
All i do is call a service in activity A, which opens my asyncTask to download the content and it broadcasts the result with the progress to activity B. Then, in activity B, i seek which view should show a progress bar and update the progress.
I used this comment as a guide to my implementation.
I am working on the Android web base Application. In my application, I am call the web services, parse it and show the parsed data on my view. The data contain text and images. My problem is when i am moving first screen to second screen(in second screen there is a xml data which is display the images and text and it has large number of data, near about 100). But when i am clicking on move button there is a blank screen appear till that xml data is loaded on view and then display the second screen.
I want to show the progress dialog on that screen till load all the data. So please help me....
A key word for you: ASyncTask
I recommend to do the XML parsing in an ASyncTask and while doing that displaying a spinner/progress bar. A tutorial can be found here: http://developer.android.com/reference/android/os/AsyncTask.html