In the new android studio version there is a new big change. I read the documentation about "Implement navigation with the Navigation components" but can somebody explain to me which is the main difference between this method and the classic one?
The navigation architecture component is part of JetPack is a new way to navigate your app.
The main different is that before you have multiple activities in your application -still you can- to move to different content areas in your app, now with the nav arch component you can have only one activity and the rest of the features of your app is based on fragments, keeping the single activity as a the main container.
In this link Ian Lake the creator of navigation architecture explains why we should use this approach.
Also, here is the guide to Navigation Architecture
https://developer.android.com/topic/libraries/architecture/navigation/
Give a look at these resources.
Best regards.
Pedro Varela
Related
Now I am wondering which is the most proper way of implementation when want to combine BottomNavigation with the new Android Architecture Navigation Component?
For now found two approaches:
Single Navigation Graph which maintains all BottomNavigation items and which is shown here from Google Codelabs: https://codelabs.developers.google.com/codelabs/android-navigation/#1
Multiple Navigation Graphs where every BottomNavigation item has its own navigation graph which maintains only its behavior and backstack which i shown here: https://proandroiddev.com/mastering-the-bottom-navigation-with-the-new-navigation-architecture-component-cd6a71b266ae
My opinion is that the second one is more clear and understandable, but maybe you have another opinion.
Having separate backstacks or not is a decision based on user experience but if you do want multiple backstacks for bottomnavigation then follow the link for correct approach by androidx developers.
https://github.com/googlesamples/android-architecture-components/tree/master/NavigationAdvancedSample
I think it depends with the number of nested fragments you will have per each navigation item. The fewer the fragments then i would use the first approach and the more the fragments then i would use the latter approach
I need to implement an app through fragments.
Based on my requirements,i have a menu panel one side and other side i need to display different ui screens based on menu selection.
My Screen contains heavy ui.That why i design each screen separately.
How should i display screens based on menu selections through fragments.
If any one know the solution,Please help me
Thanks in advance.
If you mean the NavigationDrawer you find the official Tutorial on the Android Developers Website
There is also an example to download, which uses the NavigationDrawer to switch Fragments.
If you want a fixed, self-designed Menu and just want to swap out Fragments (holded by a FrameLayout) check out this Tutorial
Android officially doesn't provide more than one sliding menus (navigation drawers). You can implement SlideMenu or choose one of many such libraries for more than one sliding menus.
Once the menus are implemented, it's just a simple case of fragments and activities. There is no "direct way". Read the documentation and understand how they work. Here are some good links
Fragments - Introduction on developer site
Tutorial on multi-pane development using fragments by Mr. Vogel
Basically what you have to do is, create an Activity extending ActionBarActivity (from support library) or FragmentActivity.
create fragments and replace them in FragmentManager from your main activity.
See this for reference:
Creating a navigation drawer
Over the past few days I've started to work with the Master/Detail template in Eclipse and I've been trying to figure out a way to take the generated Master/Detail template and convert it to have a navigation drawer-type UI. I imagine that it's possible to do, but how can I go about doing? What do I need to add/remove/modify in order to get similar/identical functionality to a navigation drawer using Master/Detail? I'm asking for assistance creating it using Master/Detail because I have tried other methods with no luck whatsoever. Also, how can I customize the look of it (background color, text color, etc.)?
Thank you in advance for any help in solving this! I have searched relentlessly for a solution with no results unfortunately so I hope that someone in the SO community can assist.
Given that the Navigation Drawer is not appropriate for displaying Master/Detail data (i.e., it is only for navigation, not showing content), then you use the same steps as converting any Activity to using a Navigation Drawer. The Android training Creating a Navigation Drawer goes into extensive detail with all the code you'd need to add a Navigation Drawer to an Activity and properly implement the Navigation Drawer design pattern.
It may make sense to start with a simple Activity, then use what you learn there to apply it to the Master/Detail template.
I really don't know what is the difference between these two approaches of creating navigation menu. So I read that both can be used as a container for two fragments (main fragment, detail fragment). So can you help me to understand which approach is better and why? I can't find out relevant information.
thank you.
The session was "Android Design for UI Developers" by Roman Nurik and Nick Butcher:
https://developers.google.com/events/io/sessions/326204977
Pretty much what CommonsWare said, essentially, Navigation Drawer is for chrome and top level navigation, so it overlays app content. SlidingPaneLayout is for content navigation, thus it doesn't overlay content.
EDIT:
The video is still available here - https://www.youtube.com/watch?v=Jl3-lzlzOJI
So can you help me to understand which approach is better and why? I can't find out relevant information.
This was covered in a Google I|O 2013 presentation, though I forget which one.
SlidingPaneLayout is for content, such as the master-detail pattern. You might use it in place of two layouts for master-detail structures for smaller and larger screens.
DrawerLayout is for navigation. You might use it in place of the dashboard pattern, or using action bar items for navigation, if you have a fair bit of navigation in your app.
I want to create a sliding drawer concept for my applications, is there a way to use the Sliding Drawer component as a base?
I'm unable to find the source at the AOSP-repository, but the 1.5 source version can be viewed at Grepcode: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/1.5_r4/android/widget/SlidingDrawer.java/?v=source
Although I haven't tried I think you should be able to use that as a base.