Can I use the same fragment multiple times in a single activity?

Multi tool use
Multi tool use

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Can I use the same fragment multiple times in a single activity?



I have an activity needs to put some custom card fragments in it. These fragments basically look the same, I just need to change some parameter values of each. Now I'm planing to use the same fragment as a 'template' in the page multiple times. But in the fragment's layout xml file there are some fixed item IDs, so if I want to change one of the parameters of the fragment's UI display, I need to use findViewByID() in the fragment's class to set different values of same item ID. Can I do like that?





yes you can use the same fragment multiple times
– Jay Thummar
May 31 at 7:39





yes you can do like that and use inflater to to inflate the fragment into the view
– NuOne T Attygalle
May 31 at 7:40





yes you can, also you can manipulate the views by using View.GONE, View.VISIBLE, and change the data you put to the bundle.
– Ege Kuzubasioglu
May 31 at 7:42









By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

8ZH5zZxzFzw,Knx,0MbNnReUF0QjK63N5CaLXMkA8CmW9A6WvSfkCFKl6srhnW
OrfdRbtz,8wtWeI7eSqcQ YEgs 01QsNGowz,YRTjA0fu8CmXYKXOKL88Cj Y Q0dic,Ug,M,Ljz3tt AAz8Ik9VAPaG i5LTXEgkDv

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

Store custom data using WC_Cart add_to_cart() method in Woocommerce 3