Is it possible to create subsequently a Navigation Drawer in Android? - android

I'm working on my App about 6 Months.
I don't know if I misread it but, is it possible to create and add a Navigation Drawer when I have different Activities?
How my App works:
SplashScreen -> LogInScreen -> Activity 1(ListView) -> Activity 2 (after click on ListView item) -> ... and so on.
Is it possible to add now a Navigation Drawer? I read something that you can add a Navigation Drawer only if you don't switch between Activities is that right?
I want a Navigation that looks on every Activity different. Is it possible or it can only have one layout?
I hope my problem is clearly explained.
Kind Regards

All your other Activities should extend The MainActivity which contains the navigationView .
helphuf links : Same Navigation Drawer in different Activities , Android: Navigation-Drawer on all activities

Yes, it is possible. I suggest following option to use navigation drawer in all Activities of App.
You have a two option :
1) Use Fragment instead of Activity and put navigation drawer to First Activity.
for Example : http://www.androidhive.info/2013/11/android-sliding-menu-using-navigation-drawer/
2) Create One layout for navigation-drawer and include it to all layout of your Activities using "" tag in xml Like this link : navigation drawer layout with include layout
for Example : Same Navigation Drawer in different Activities

Related

Adding a navigation drawer to an existing project

I'm a beginner in Android. I have a project with multiple activities and I need to add a navigation drawer to this project instead of a normal menu. I added a new navigation drawer activity, but it doesn't show in my previous activities.
Should I add something to my existing activities?
All the tutorials I have watch use fragment while I use AppCompatActivity.
So I don't know how can I add it to my project.
Can you help me, please?
to do that, you have to use fragments instead of activities. fragments are easier to work with navigation drawers than activities. 1st you have to create a main activity for navigation drawer. Change your other activities to fragments. Then you can have navigation drawer in all the fragments. Refer below video it has everything you want. if there is any problem ask. https://www.youtube.com/watch?v=-SUvA1fXaKw

How to add the same ActionBar in all the activities And how to show the navigation drawer in all activities

I have created an app with navigation drawer which I want to show on all the activities. And I want to show the same actionbar how can i do it?
I had created my app in android studio with
minSdk =15
and TargetSdk=23
And how can I fetch the email id of the user in navigation drawer .
The better way is , You have to implement fragment instead of seprate activities but if you have implemented activities and you don not want use fragment than you have to create a java class for navigation drawer and call the same class in each activity and also include the view in each activity but it is not good practice.

Adding navigation drawer to AppCompatActivity

I need to add a navigation drawer to my app. The activities extend AppCompatActivity. I want the navigation drawer to be used in some of the activities. The navigation drawer should look something like the one if the play store (i.e. a circled ImageView and some text + a listView). Can I edit the code available when creating a new navigation drawer activity in Android studio?
I tried the following code Here and extended it in my activity but it didn't work.
Sometimes using the navigation drawer template activity is a complete mess. Try this tutorial. Slidenerd is a really good source for the new material design stuff. :)

How to call navigation drawer in all my activities?

I have my MainActivity that contains a navigation drawer with items. When I click on an item,it opens up a new activity. This activity has its own layout file. I want to call the navigation drawer in this activity as well. How do I do that? Because I want to navigate through the app using the navigation drawer,rather than pressing back button all the time.
Let's say I have 2 activities, both of which I want to have the Navigation Drawer. In the layout.xml for each, I specified a DrawerLayout with the appropriate list view to hold my navigation options. Essentially, the Navigation drawer is made every time I switch between activities, giving the appearance that it is persisting. To make life a lot easier, I took the common methods required to set up the navigation drawer and put them in their own class: NavigationDrawerSetup.java. That way my activities can use the same custom adapter, etc.
Complete Reference : NavigationDrawer with Multiple Acivities

How to make the Navigation Drawer or bottom selection bar always accessible in an android project?

I am developing an Android project with Android Studio.
I would like to have the menu is always accessible in every view like Google Play Store (the Sidebar) and App Store (the Bottom selection bar).
I am thinking to do it in two ways:
Make my app have only one activity with Navigation Drawer, all the other views are above this activity using fragments.
Recreate the sidebar or bottom selection bar every time I switch to another activity.
Both of these two ways are very complex and cost a lot. Do you have some better ways?
PS: If not, could you suggest me some links about how to implement these two methods?
Thanks a lot.
you can create a MasterActivity that extend Activity and contain your sidebar. other Activity can extend from your MasterActivity by this way you can access your sidebar on each activity.
I think you should use the default navigation drawer and default action bar.
If you are using the Android Studio then
right click on your package and go to New/Activity/Navigation Drawer Activity.
That will create navigation drawer fragment and activity automatically.
But If you are using Eclipse then these links will be useful for you.Navigation Drawer
Action Bar
you can use include tag in other layout activity and call Navigation Drawer:
<include
android:id="#+id/nDrawer"
layout="#layout/your_NavigationDrawerLayoutName"/>

Categories

Resources