AppleGrew
AppleGrew

Reputation: 9570

How to keep a fragment running in background which can also be brought to foreground when needed?

Weird but I could not find any related text on this on the net.

I have a fragment with Cordova WebView in it. The app has many other fragments with native list views, etc. User can use the options in Navigation Drawer to switch between the fragments, one of which is the WebView fragment.

I want that the WebView fragment keeps on running in background when it is replaced by another fragment. Later based on user's choice, this fragment might need to be brought to the foreground again.

Is this possible?

Upvotes: 0

Views: 1264

Answers (1)

JstnPwll
JstnPwll

Reputation: 8685

If you call replace(), the fragment is removed. You could instead try detaching the fragment from the UI using detach(), and then later recalling it with attach().

Upvotes: 1

Related Questions