Reputation: 26668
Is there a way to initialize a Fragment fully, without showing it immediately?
I have a WebView in a Fragment, but I don't want to show the Fragment until the WebView is done loading a URL. However, it seems like I'm not actually able to initialize the Fragment without displaying it?
Upvotes: 1
Views: 315
Reputation: 506
You can create a new Object
of your Fragment
and do Operations on it ,
if you do not put it on the stage with the FragmentManager
.
I would recommend you to start loading the Content of the URL in a function, independent of the UI.(NOT onCreateView
)
Upvotes: 1
Reputation: 157457
as workaround you can call view.setVisibility(View.INVISIBLE);
before returning your View inside onCreateView
.
Upvotes: 0