내가 활동이 FragmentActivity
에서 확장 있고, 내가 Fragments
의 네 개의 탭이있을 때 FragmentActivity에서 조각 텍스트 뷰를 업데이트하는 방법, 내가 업데이트 할, 서버에서 부하 데이터를 가져 오기 위해 주요 FragmentActivity
에서 AsyncTask
, 그래서 각 조각 데이터는 부모 데이터에서 AsyncTask 함수를 완료 할 때 android.support.v4.view.ViewPager
빈 데이터로 작업을 시작할 때 모든 조각의 UI 로딩을 사용하므로 AsyncTask에서 가져 오는 데이터로 각 조각 필드 (TextView)를 업데이트하려고합니다. , 어떻게 업데이트 할 수 있습니다. 당신의 도움을 주셔서 감사합니다. 여기에 조각마무리 AsyncTask를
@Override
public Fragment getItem(int position) {
switch (position) {
case 0:
Fragment fragmenthome = new HomeFragment();
return fragmenthome;
case 1:
Fragment fragmentdiagnosis = new DiagnosisFragment();
return fragmentdiagnosis;
case 2:
Fragment fragmentcareplan = new CareplanFragment();
return fragmentcareplan;
case 3:
Fragment fragmentnote = new NoteFragment();
return fragmentnote;
case 4:
Fragment fragmenttask = new TaskFragment();
return fragmenttask;
}
return null;
}
을 얻을에 사용 아래의 코드는 여기
public static class DummySectionFragment extends Fragment {
/**
* The fragment argument representing the section number for this
* fragment.
*/
public static final String ARG_SECTION_NUMBER = "section_number";
public DummySectionFragment() {
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_main_dummy,container, false);
TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
dummyTextView.setText("Comming Soon...");
return rootView;
}
}
이 공용 클래스 PatientActivity이 FragmentActivity가 {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_patient);
// AsyncTask function calling
ActionBar.TabListener를 구현 확장의 주요 활동을하는 샘플 조각입니다 }
일부 코드를 표시하십시오. – Piyush
코드는 SectionsPagerAdapter mSectionsPagerAdapter를 사용하여 TABS of Fragments의 기본 활동입니다. –
onPost가 실행되면 조건을 사용하여 onResume()을 처리하고 플래그를 true로 표시하고 여기에 업데이트 코드를 입력하십시오. –