Answer the question
In order to leave comments, you need to log in
FragmentTransaction lags?
Good day everyone!
Unforeseen problems occurred while coding an Android app. Let's start with the fact that this piece of code runs without problems:
CalendarDialogFagment dialog = new CalendarDialogFagment();
dialog.setTargetFragment(this, 0);
dialog.show(getActivity().getSupportFragmentManager(), "dialog_calendar");
if (calendarContainer == null)
calendarContainer = getActivity().findViewById(R.id.games_calendar_container);
boolean isShown = calendarContainer.isShown();
if (!isShown) {
calendarContainer.setVisibility(View.VISIBLE);
if (calendarFragment == null) {
calendarFragment = new CalendarDialogFagment();
calendarFragment.setTargetFragment(this, 0);
FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
ft.add(R.id.games_calendar, calendarFragment, "tag");
ft.commit();
getActivity().getSupportFragmentManager().executePendingTransactions();
}
}
else{
calendarContainer.setVisibility(View.GONE);
calendarContainer = null;
}
}
<LinearLayout
android:id="@+id/games_calendar_container"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/stagelayout"
android:orientation="vertical"
android:visibility="gone"
android:weightSum="100" >
<View
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="95" />
<LinearLayout
android:id="@+id/games_calendar"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="5"
android:background="@color/dark_gray" >
</LinearLayout>
</LinearLayout>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question