Issue
I have to do some heavy calculations in the onCreate method of my activity. That's why I put that stuff inside a thread that I start in the onCreate function.
Unfortunately some things in onStart do dependent on those calculations. But unfortunately onStart gets now called before the heavy calculation thread finishes (when the app was freshly started).
It it a good pattern to call onStart again manually after the calculation thread is finished?
Solution
It's a bad practice. You shouldn't manually invoke lifecycle callbacks.
Instead either:
- block the UI (perform work in
onCreate) - another bad practice - perform the work that you'd do in
onStartlater, i.e. after your work is finished.
Answered By - Simas
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.