I am having this problem when working with Navigation Drawer and Activities instead of Fragments. Everything runs smooth, but when i initialize the Drawer (DrawerHome) I hit an screen which is not neither of my Activities. When I set default to be any of the Activities, the executions runs into loop and never stops. I am just wondering if it is possible to achieve this or I must go and user Fragments and only one Activity.
Thank you in advance for your time and effort.
Really appreciate.
Related
I have an application where it is required to persist the bottom navigation across multiple screen. Now naturally bottom navigation works well with fragments but the problem is that my other fragments also have other screens to call which is usually delegated back to the handling activity.
With said, when i tried implementing the bottom navigation with fragments the activity becomes a God Activity where it handles all fragments.
So my solution was to start an activity instead. But the problem with this approach is that every start of the activity the activity transition makes it obvious an activity is being started. I tried setting off the activity transition to avoid this but now Im left with a very static page which just suddenly changes. I still want my views to animate smoothly between screen changes.
Can someone give me an advice here. Heres what I would want to achieve in summary:
1) make it seem the bottom navigation was not changed/moved (and hopefull still have the shifting animation if possible)
2) animate smoothly between screen changes
3) also still have the capability of having shared element transition if possible.
Please help me here. Thank you so much in advance.
I’m using the MvxCachingFragmentCompatActivity with a single fragment for every screen. During normal navigation the next view/fragment loads within an acceptable time-frame. When I use back navigation to a previous screen it takes much much longer.
While closing a fragment (when navigation back) I’m not doing anything, and still it takes over 2 or 3 seconds. I expected back navigation to be faster than normal navigation because views and viewmodels are already cached. The only thing it needs to do is invoke OnCreate again on the old view, while sometimes my OnCreate is almost empty and even then the delay is also noticeable.
Anyone got the same behaviour with fragments in mvvmcross 4, or has anyone tips how to approach this?
My Action bar consists of two tabs (a list of businesses and a map of businesses). If someone chooses from the list I would like to hide the tabs and show that business' page. If the user hits back, the business fragment is popped and the tabs should be displayed again.
What is the best approach to get this working? So far with the following code I have an inexplicable recursive loop if I pop the business fragment :(
So picture this, I'm displaying the BusinessListFragment tab. I choose a business, swap fragments and in onPause() I set the navigation mode to standard. Hit the back key, and in the onResume() of the BusinessListFragment I have this:
ActionBar ab = mHostingActivity.getSupportActionBar();
if (ab.getNavigationMode() == ActionBar.NAVIGATION_MODE_STANDARD)
ab.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Which is supposed to bring back the tabs, but the app freezes with a loop. The tabs are definitely still present. Maybe I'm doing something else strange in my code (I'm sure I'm not though), or maybe Android does something strange when the naviagtion mode is set?
Edit: I've learnt that simply setting the navigation mode to tabs seems to actually select the first tab - which I believe would explain the recursion. Interesting!
Okay well this took a while to figure out but hopefully this will help future googlers :D
It seems the best practice is to never try and hide / show tabs by setting the navigation mode from within a tab fragment's onResume / onPause, or anywhere within it for that matter.
I therefore set the mode to Standard in the onResume() of the detail (business) fragment. Normally if there are no more hierarchical layers of navigation to traverse from within the detail fragment, it is fine to simply set the mode back to Tabs in the detail fragment's onPause() - accounting for back presses or up presses.
However in my case you can click on elements within the business page to launch another fragment (leaving a stack count of 3), meaning I cannot 'turn on' tabs within onPause(), and found the best solution was to do it within onDetach(). This should mean the tabs are only turned on when the detail fragment is actually popped from the stack.
Hopefully this solution is accurate, I have toyed with many ideas including back stack listeners and overriding onBackPressed, but for me this seems to be the best option.
i've got a tabbed layout, and on one of the tabs i have a search functionality. When the user makes a new search, i need to show the results. However, doing so involves starting another activity to handle the search results.
this causes the tabs at the bottom to disappear. The user can get the tabs back by clicking on the 'back' button. But somehow, in the context of my application this can be a bit counter-intuitive and seems to be break the common layout flow.
is there any way to prevent the tabs from disappearing when invoking the search from one of the tabs?
thanks for any help/suggestions.
as far as i can understand your problem, You are not using tabs then you are using buttons. see some tabhost tutorials on how to create a tabbed activity. what you are doing is launching a new activity instead of just switching a tab in the existing one.
Also the other things you can look for are activity groups.
Hope this helps you somehow.
I'm searching all over but cannot seem to find a answer to this.
I have my main HomeActivity view which contains a SlidingDrawer in the main.xml layout. The sliding drawer works fine. What I'd like to do though is that when the SlidingDrawer is opened, I want to launch a new activity in the sliding drawer view, and when the drawer closes it drops a result.
So in theory I'm looking at launching an activity with the startActivityForResult method and when the SlidingDrawer closes, processing the result? Is this at all possible or am I out to lunch?
I have recently given this some thought and although actually having the activity itself display inside the SlidingDrawer contents is impossible, theoretically you could simulate this buy copying the layout you are going to, and putting that as the contents, then as soon as the sliding drawer is done, go to the new activity. I haven't tried this myself but it might actually look nice. It won't be perfect but I think it could work.
Another way is to merge both those activities into one and use the sliding drawer to show the other layout.
Anybody have any better ideas I'd love to hear them also!