Android教程(2018)-11-在運行時向活動添加片段



在本視頻中,我們將學習如何在活動運行時添加刪除或替換片段。
像我的Facebook頁面一樣:https://www.facebook.com/codeglympse
訂閱我的YouTube頻道:http://www.youtube.com/ticoontechnologies。

35 comments
  1. 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

  2. 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

  3. 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.

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

    Anything different or it's same???

  5. 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

Comments are closed.