call method from fragment to Activity

前端 未结 4 2114
孤城傲影
孤城傲影 2021-01-26 06:53

hello i have activity and i call many fragment based on my application business i need to call method from fragment in activity i searched in the internet but i cannot find the

4条回答
  •  攒了一身酷
    2021-01-26 07:48

    Just call the method of Fragment by creating the object of it.

    HomeFragment homeFragment = new HomeFragment();
    homeFragment.addUserLineInfoFragment();
    

提交回复
热议问题