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
Related
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?
Imagine i have a frameLayout in my main activity, and two fragments,
so now first fragment is being displayed, i replaced it with secondFragment and added first one to back stack, now some condition is met in the secondfragment so i want to close the second fragment and open the first one where we left that (basically back from the back stack) without pressing the back button. how do i achieve this ?
you can write this code for removing current fragment from backstack:
getActivity().getSupportFragmentManager().popBackStack();
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.
I have one activity with ListView and 2nd activity which have ViewPager. Now I want in one activity if status true then go to 2nd activity `
Intent n = new Intent(one, two);
startActivity(n);`
But here problem is it giving opening animation is any i can do within that 1st activity
any way i can avoid that animation and it look like it is same activity
or i have to redo full code and this inside 2 fragments ? so have one fragment activity and then but one activity code inside fragment and two activity inside fragment which will have view pager.
Paraphrasing you, your are trying to call activity B from activity A, based on a result, which is an item picked from list item, however you wanna avoid any sort of screen transitions (animations) when moving from one another.
I may be wrong but my google search didn`t revealed any way to avoid transition between activities.What your could actually do is to refactor your code using fragments and sort them out within the parent activity view group in a way that fragment B maximizes itself or pops up over fragment A pausing it.
Brs.,
I am having a main activity and two fragments. By default the first fragment appears on the activity (Let's call this fragment 'A'). On a button click I am adding second fragment to the activity (Let's call this fragment 'B'). I have set the screen orientation of the activity as portrait in manifest.
Issue I am facing is that when I call the camera from fragment B and I take an image in landscape mode and clicks on the tick icon in camera intent, my application is coming back to fragment A instead of fragment B.
It will be helpful if anyone can suggest me a solution for this issue.
In your onActivityResult() method, you may want to set which fragment you want to load after taking a picture.