This repository was archived by the owner on Feb 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
@AfterViews method is called multiple times if the same @EFragment instance is added again #1264
Copy link
Copy link
Closed
Description
the first to enter called once ,the second to enter called twice,and so on
This is my code
public void beginTransaction(Fragment fragment, String tag, Bundle bundle) {
try {
manager = getFragmentManager();
if (bundle != null) {
fragment.setArguments(bundle);
}
transaction = manager.beginTransaction();
transaction.replace(R.id.main, fragment, tag);
transaction.commit();
} catch (Exception e) {
e.printStackTrace();
}
}
@CheckedChange({ R.id.main_tab_project, R.id.main_tab_moment,R.id.main_tab_infomation,R.id.main_tab_personal_info })
void checkedChangedOnSomeCheckBoxs(CompoundButton btn, boolean isChecked) {
if (isChecked) {
switch (btn.getId()) {
case R.id.main_tab_project:
beginTransaction(mFragmentProjectList,"mFragmentProjectList",null);
break;
case R.id.main_tab_moment:
beginTransaction(mFragmentMoment,"mFragmentMoment",null);
break;
case R.id.main_tab_infomation:
beginTransaction(mFragmentInformation,"mFragmentInformation",null);
break;
case R.id.main_tab_personal_info:
beginTransaction(mFragmentPersonal,"mFragmentPersonal",null);
break;
}
}
}<RadioGroup
android:id="@+id/main_radio"
android:layout_width="match_parent"
android:layout_height="@dimen/comm_line_height"
android:layout_alignParentBottom="true"
android:padding="@dimen/comm_space_3"
android:gravity="bottom"
android:background="@color/header_background_color"
android:orientation="horizontal" >
<RadioButton
android:id="@+id/main_tab_project"
style="@style/MainTabTheme"
android:drawableTop="@drawable/selector_main_tab_project"
android:text="@string/main_tab_project" />
<RadioButton
android:id="@+id/main_tab_moment"
style="@style/MainTabTheme"
android:drawableTop="@drawable/selector_main_tab_project"
android:text="@string/main_tab_moment" />
<RadioButton
android:id="@+id/main_tab_infomation"
style="@style/MainTabTheme"
android:drawableTop="@drawable/selector_main_tab_information"
android:text="@string/main_tab_information" />
<RadioButton
android:id="@+id/main_tab_personal_info"
style="@style/MainTabTheme"
android:drawableTop="@drawable/selector_main_tab_personal_info"
android:text="@string/main_tab_personal_info" />
</RadioGroup>Metadata
Metadata
Assignees
Labels
No labels