Activity with no fragment shows white background before finish - android

I have added number of fragments using fragmentTransaction's add and replace methods. After an action, I removed all the fragments in layout and when the back stack is empty, I called finish() on the activity. However before the finish is executed, the activity background (white) shows for few milliseconds. How do I make sure the activity finish as soon as the last fragment is removed so the background of the activity doesn't show?

Related

change activity theme inside the fragment without recreating it

I have an activity which has some fragments and fragments are replaced with each other in activity when some special events happen. when I change the activity's theme, it will be recreated and it will add the first fragment and I will loose the back stack, the problem is that
I want to know that is there any way to start activity and attach the last fragment to it? or can I send back stack Fragments to the recreated activity?
Thanks.

On back button fragment not shown

I have 3 activities. Second activity has a fragment. When I click back from 3rd activity, 2nd activity is not shown.Instead goes to 1st activity. While debugging, it is going to oncreateview method of fragment on backpress from 3rd activity & view is also returned but not visible on screen. It seems it comes on the screen for fraction of second and goes to first activity, hence not visible.

startActivity() first remove the fragment and only then moves to another Activity

I have an Activity with a fragment in front. now when i use StartActivity() the fragment is first removed and you can see for a half a sec the Ui of the activity before it moves to the next Activity...
any idea how to keep the fragment in the front until the last moment before switching to the next Activity?
Thanks

Fragment's Actionbar doesn't work when came back from another Activity sometimes

I have an Activity on which I am stacking two Fragments one at a time, when the second Fragment is visible and on click of some View I am launching another Activity and when I press back from there it will show the second Fragment but it doesn't update the ActionBar instead it will show the ActionBar of first Fragment.
Also, I am Overriding onResume() in the First Activity in which I am calling onResume() of visible Fragment. I am updating the ActionBar inside onResume() of the Fragment. Everything is getting called properly but still not updating the ActionBar.

Issues with activity group

I have an app in which I am implementing a tab bar with 3 tabs. In first tab I am implementing multiple activities by using activity group.
In this activity group I have 5 activities. In the first activity I am having edit texts, I am getting the data into edit texts from another class and then navigating to another activity by clicking a button. When I am coming back from second activity to first activty I am not able to see the selected data. It is showing the page without selected data.
I don't understand this.
From the documentation:
This class is deprecated...
And now coming to your question, you said:
... When i am coming back from second activity to first activty i am not
able to see the selected data...
It is default behavior of ActivityGroup, when you move forward, your current Activity's state is not saved and when you come back to previous Activity, it is started again and onCreate() is called again.
its because, in Activity Group Implementation, all the activities are re-created and then generates view, and then adding this view in window activity is displayed. So, everytime a new activity is displayed, as activities are re-created.

Categories

Resources