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.