2014-05-23 1 views
3

다른 단편 "fragB" 안에 단 하나의 탭()이 있습니다. 단 하나의 메소드 인 "fragB""fragA"에서 호출해야합니다. 내가 활동에서 수행 할 때 ,이 작업을 수행합니다 중첩 된 단편에서 메소드를 호출하는 방법

FragB detailsFragment=(FragB)getSupportFragmentManager().findFragmentById(R.id.detailFragment); 

detailsFragment.consultaWS(convertIntWebService(categoria),"Pdf"); 

이 날

답변

2

가 마침내 fragA,이 방법으로 해결할 수 있다고 설명 :

FragB parentFragment = (FragB) getChildFragmentManager() 
             .findFragmentByTag("detallesFragBusqueda"); 
if (parentFragment != null) { 
    parentFragment.consultaWS("", "AllPdf"); 
} 
0

귀하의 활동이 조각 사이의 모든 통신을 용이하게한다 도와주세요. 액티비티에서 프래그먼트가 호출 할 수있는 메소드를 작성하면 다른 프래그먼트가이를 수행하도록 지시합니다.

0

FragA가 FragB 안에있는 경우 FragA에서 동일한 작업을 수행 할 수 있습니다.

FragB parentFragment = (FragB)getActivity().getSupportFragmentManager().findFragmentById(R.id.detailFragment); 
parentFragment.fragmentBMethod(); 
0
Fragment fragment = getFragmentManager().findFragmentById(R.id.fragment_main_container); 
if (fragment != null) {  
     ((TabLayoutFragment)fragment).tabClickDisable(); 
}