Is there a problem with instantiating a fragment twice?

Asked

Viewed 31 times

0

I have a Fragment that is the first to be opened, is a list of items!

Then depending on the button clicked on the Cards inside this Ragment it opens a screen with a Tablayout with some tabs and one of these tabs is just this first Ragment that is being reused but it should load another list of items. They are the same TYPE of items but it is another list!!!

Every time I try to do this it is instantiated by Fragmentpageradapter with the same list as when the APP was opened even calling the correct method to search for another list!!!

1 answer

1

There is no problem, as long as each call has a new instance, which is certainly the case. I have an application that has a single fragment for several moments and never had any problem. Even it is always the best thing to take advantage of the codes as much as possible so as not to swell the app unnecessarily.

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.