Best practices to show a progress for Android JetPack?









up vote
1
down vote

favorite












We should init our ViewModel asynchronously. Loading the data right from a local SQLite DB could be quite fast(but not always). If we will pump data from some remote source it could be pretty notable delay. So user needs some visual feedback on it and main UI must not be available.



What are the best practices to show progress while data is preparing for ViewModel or when we send some data for processing(waiting for changes in the ViewModel)?



E.g., if LiveData value is null switch onto the Loading Progress fragment and prepare the ViewModel there and switch back when it will be ready? But ViewModel use to be bound to particular fragment...



Just make some root view invisible while data is loaded/processed? Other words add into each fragment some progress section to show it instead of main content?
But this approach requires too much boilerplate code for a lot of layouts.



Should we ever take care on it if know that data expected to be loaded almost immediately?



How do you handle long running operations UI in your JetPack apps?










share|improve this question





















  • how much data are you loading? is it a long list of some items?
    – pskink
    15 hours ago










  • there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
    – engilyin
    5 hours ago










  • see developer.android.com/topic/libraries/architecture/paging
    – pskink
    5 hours ago














up vote
1
down vote

favorite












We should init our ViewModel asynchronously. Loading the data right from a local SQLite DB could be quite fast(but not always). If we will pump data from some remote source it could be pretty notable delay. So user needs some visual feedback on it and main UI must not be available.



What are the best practices to show progress while data is preparing for ViewModel or when we send some data for processing(waiting for changes in the ViewModel)?



E.g., if LiveData value is null switch onto the Loading Progress fragment and prepare the ViewModel there and switch back when it will be ready? But ViewModel use to be bound to particular fragment...



Just make some root view invisible while data is loaded/processed? Other words add into each fragment some progress section to show it instead of main content?
But this approach requires too much boilerplate code for a lot of layouts.



Should we ever take care on it if know that data expected to be loaded almost immediately?



How do you handle long running operations UI in your JetPack apps?










share|improve this question





















  • how much data are you loading? is it a long list of some items?
    – pskink
    15 hours ago










  • there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
    – engilyin
    5 hours ago










  • see developer.android.com/topic/libraries/architecture/paging
    – pskink
    5 hours ago












up vote
1
down vote

favorite









up vote
1
down vote

favorite











We should init our ViewModel asynchronously. Loading the data right from a local SQLite DB could be quite fast(but not always). If we will pump data from some remote source it could be pretty notable delay. So user needs some visual feedback on it and main UI must not be available.



What are the best practices to show progress while data is preparing for ViewModel or when we send some data for processing(waiting for changes in the ViewModel)?



E.g., if LiveData value is null switch onto the Loading Progress fragment and prepare the ViewModel there and switch back when it will be ready? But ViewModel use to be bound to particular fragment...



Just make some root view invisible while data is loaded/processed? Other words add into each fragment some progress section to show it instead of main content?
But this approach requires too much boilerplate code for a lot of layouts.



Should we ever take care on it if know that data expected to be loaded almost immediately?



How do you handle long running operations UI in your JetPack apps?










share|improve this question













We should init our ViewModel asynchronously. Loading the data right from a local SQLite DB could be quite fast(but not always). If we will pump data from some remote source it could be pretty notable delay. So user needs some visual feedback on it and main UI must not be available.



What are the best practices to show progress while data is preparing for ViewModel or when we send some data for processing(waiting for changes in the ViewModel)?



E.g., if LiveData value is null switch onto the Loading Progress fragment and prepare the ViewModel there and switch back when it will be ready? But ViewModel use to be bound to particular fragment...



Just make some root view invisible while data is loaded/processed? Other words add into each fragment some progress section to show it instead of main content?
But this approach requires too much boilerplate code for a lot of layouts.



Should we ever take care on it if know that data expected to be loaded almost immediately?



How do you handle long running operations UI in your JetPack apps?







android user-interface android-architecture-components android-jetpack long-running-processes






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 15 hours ago









engilyin

300310




300310











  • how much data are you loading? is it a long list of some items?
    – pskink
    15 hours ago










  • there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
    – engilyin
    5 hours ago










  • see developer.android.com/topic/libraries/architecture/paging
    – pskink
    5 hours ago
















  • how much data are you loading? is it a long list of some items?
    – pskink
    15 hours ago










  • there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
    – engilyin
    5 hours ago










  • see developer.android.com/topic/libraries/architecture/paging
    – pskink
    5 hours ago















how much data are you loading? is it a long list of some items?
– pskink
15 hours ago




how much data are you loading? is it a long list of some items?
– pskink
15 hours ago












there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
– engilyin
5 hours ago




there could be different cases. Couple of fields or long paged list. Also it could be from local DB or from the remote service.
– engilyin
5 hours ago












see developer.android.com/topic/libraries/architecture/paging
– pskink
5 hours ago




see developer.android.com/topic/libraries/architecture/paging
– pskink
5 hours ago

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236742%2fbest-practices-to-show-a-progress-for-android-jetpack%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53236742%2fbest-practices-to-show-a-progress-for-android-jetpack%23new-answer', 'question_page');

);

Post as a guest














































































這個網誌中的熱門文章

What does pagestruct do in Eviews?

Dutch intervention in Lombok and Karangasem

Channel Islands