Posted on



In this video we are going to learn about how to add remove or replace a fragment at activity run time.
Like my Facebook page :
Subscribe My YouTube channel :

Nguồn:https://hdwallpaperslovely.com/

33 Replies to “Android tutorial (2018) – 11 – Add a Fragment to an Activity at Run time”

  1. Can you make video on how to load dynamically recycler view inside view pager with tab layout based on JSON data

  2. In my case savedInstanceState is null. application crashes while i press button From home Fragment.. i make atoast in else condition of SavedIncstanceState then i run app and toast comes on screen

  3. Better you find someone else to explain as it is difficult to understand you. Sorry for saying this but its true

  4. Can you give the specification why fragment only displaying inside the fragment container not the whole ACTIVITY. IN SIMPLE TERMS , how can you associate the fragment with fragment container

  5. static FragmentManager fragmentmanager …只是为了教学方便吧….这么写 不会内存泄漏么..^_^

  6. Anyone who is having problem in “add” method for new HomeFragment () kindly check. There are two “add” methods with same argument type. Wisely choose the one. Try alternative one if former is giving error.

  7. Why this?
    public Static FragmentManager fragmentmanager;
    fragmentmanger = getfragmentmanager();
    not this?
    public static FragmentManager fragmentmanager = getfragmentmanager();

    Anything different or it's same???

  8. How to add multiple fragment in runtime
    For Example:
    In Main Activity we have set one Add Fragment Button.
    When i click the add button new fragment's are create in runtime every click event
    If i press add button in 4 times 4 fragments are create or else i press add button in 10 times 10 fragments are created….
    I hope you are understand my thought

  9. i´ve got some renderproblems with the fragment_home.xml, does somebody have similar issues or know how to solve it?

Leave a Reply

Your email address will not be published. Required fields are marked *