Bottom Navigation Bar in Android Studio [Kotlin 2020]

  Рет қаралды 45,250

CodeWithMazn

CodeWithMazn

Күн бұрын

In this video, you will learn how to add a bottom navigation to your activity and how to switch between different fragments in android studio using Kotlin. Also, you will learn how to add menu items and how to style them. Then, you will learn how to navigate between the fragments or panels using FrameLayout and check which item in the bottom navigation bar has been clicked using OnNavigationItemSelectedListener interface. Once the chosen item has been clicked in the bottom navigation bar, the fragment would be changed with help of getSupportFragmentManager, beginTransaction and replace methods.
Watch the Firebase video series on how to build an authentication system in android studio
www.youtube.co....
🔴 Subscribe for more educational tutorials on CodeWithMazn channel!
Follow me on Instagram
/ codewithmazn

Пікірлер: 104
@christianmcmullin
@christianmcmullin 2 жыл бұрын
I've looked at so many tutorials and this is the only one that I was able to use to get the bottom nav to work. Thanks,
@Peregrine1984
@Peregrine1984 4 жыл бұрын
Really appreciate the video, thanks! I'm not sure how singular my experience is, but coming to Android Studio / Kotlin after not programming for ~15 years certainly has some interesting challenges. I'm finding lots of content of how to code, which I already know, but a lot of stuff I have no understanding of like Activities/Fragments/Contexts seem to be taken for granted and are taking a frustratingly long time to develop my understanding of with the content I've been able to find so far. Enjoyed the content and pace of the video and will be watching through more of your channel, as well as now on the subscriber list. Thanks again!
@CodeWithMazn
@CodeWithMazn 4 жыл бұрын
I am really glad that you liked the content. It is really important to understand how minor things work under the hood. Unfortunately, due to time constraints we tend to rush to solve problems without truly understanding the fundamentals. I did not realize how important it is to understand the very basic fundamentals until I was doing my masters degree on blockchain based decentralized applications. I couldn't find a lot of materials online and the only way to solve what I wanted to achieve was to learn and pay attention how things really work. Ever since I pay a lot of attention to details. It is beautiful how there is always something to learn! Nevertheless, I am happy to have you on my channel/journey! Lets code and spread knowledge together!
@declu0708
@declu0708 3 жыл бұрын
Excellent tutorial, it was easy to follow and well explained. Please consider zooming in when coding because it's hard to see especially if you're watching your tutorials on an iPad or smartphone. Other than that, excellent content pal!!!
@franco4853
@franco4853 2 жыл бұрын
Excellent tutorial, Im learning english and also learning how to program in kotlin and you helped me a lot, thanks
@cntrvsy
@cntrvsy 4 жыл бұрын
just exactly what i was looking for.. thanks for uploading this
@CodeWithMazn
@CodeWithMazn 4 жыл бұрын
Glad to hear that! Hope you enjoyed it!
@DavidFrancisIslandwebdesign
@DavidFrancisIslandwebdesign 3 жыл бұрын
Very nice tutorial, simple , short straight forward
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
I am glad you liked it. More tutorials are coming! Stay tuned!
@malen3995
@malen3995 2 жыл бұрын
My android studio doesn't know bottom_navigation.setOnNavigationItem..... how can i do with that problem
@L3X1_22
@L3X1_22 3 жыл бұрын
10:26 js moment XD, great video btw, i just understand the f****** bottom navigation, thanks man
@shivamraval8682
@shivamraval8682 2 жыл бұрын
very nice explanation sir keep it up , love you
@ilhamaliyudin4779
@ilhamaliyudin4779 4 жыл бұрын
Will be more clean and consice if using navigation component
@CodeWithMazn
@CodeWithMazn 4 жыл бұрын
Thank you for your feedback! I will check it out!
@nazokatyusupova1459
@nazokatyusupova1459 2 жыл бұрын
hi, thanks a lot for this helpful tutorial!
@aniketasati3897
@aniketasati3897 2 жыл бұрын
I have done all the things still my dashboard,settings,info screen is not visible...What to do?
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
Hello Sir! Thank you for your cool tutorial. It was wonderful. But at 9:55 I wrote the following “bottom_navigation” but it become red (unresolved reference). And I was using the “firstFragment” word instead of your “Dashboard” for the whole pattern but at 11:36 it also become red, and as the same as this, my word “secondFragment” become red. Why? And my menu navigation took them all at the head not to the bottom. Can you help me please to solve these problems? Everything was fine except those parts. I inserted the right dependencies in build.gradle(module). I couldn’t identify the above problems source.
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
Thank you so much. I got it. Everything is resolved.
@greisbaam3241
@greisbaam3241 3 жыл бұрын
9:55 lateinit var bottomNavigationView: BottomNavigationView bottomNavigationView = findViewById(R.id.idBottomNavigation) bottomNavigationView.setOnNavigationItemSelectedListener { when(it.itemId){........
@greisbaam3241
@greisbaam3241 3 жыл бұрын
add plugins to build.gradle(Module: ...app) ....... plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-android-extensions'//this } This is for not using ""findViewById"""
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
@@greisbaam3241 Thank you so much.
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
@@greisbaam3241 It works now. Thank you for your genuine support. But my big question is how to manage fragments and activities. I made all my data on activities. Should I move home activity (main activity) to home fragment in order to use fragments? my Home activity is the parent activity. Is it possible to put the data on the fragment as the same as I put in the activity? The splash screen is also before main activity. How can I work on fragments properly? I couldn't solve the problem. I finished my project but I removed the fragments. when I open my app, it crashed several times because of it. Just tell me the concept in short words, not the codes. I want to know how to figure out the function of the fragments.
@pedro_sousa_dev
@pedro_sousa_dev 2 жыл бұрын
Excellent tutorial! A very good explanation
@ibrahimabdul4206
@ibrahimabdul4206 3 жыл бұрын
Hey there, when I try to do the step 9:53 my bottom_navigation is showing an error (it's red) and alt + enter shows 'create abstract ...'. I've followed every step and on main_activity named it bottom_navigation too so I'm not sure why it's not catching it. Also, 10:00, my 'it' is in red and shows an error too. Apart from that everything is working fine. Any advice? thank you!
@muhammadadriannor3612
@muhammadadriannor3612 3 жыл бұрын
try this => id 'kotlin-android-extensions' add into build.gradle (app) at the top
@bismoaghna5407
@bismoaghna5407 3 жыл бұрын
@@muhammadadriannor3612 THANKS
@santiagonex213
@santiagonex213 3 жыл бұрын
@@muhammadadriannor3612 Thanks!!!
@haritnaik9534
@haritnaik9534 3 жыл бұрын
@@muhammadadriannor3612 thanks a lot man !! it worked :)
@rizkidelagaprasetya1518
@rizkidelagaprasetya1518 2 жыл бұрын
@@muhammadadriannor3612 thanks a lot man
@itsukieru7795
@itsukieru7795 3 жыл бұрын
hi there nice tutorial! i have a question. i followed everything but there is 2 errors in the "MainActivity.kt". the "bottom_navigation" and "it" have errors called unresolved reference. can you please help me fix it? thanks!
@sikshaylanime145
@sikshaylanime145 2 жыл бұрын
Turn on the internet and sync again in gradle... It downloads dependencies from Internet
@srijanpandey8226
@srijanpandey8226 2 жыл бұрын
Hi, amazing tutorial but I am new to kotlin and I have an error which says -> Type mismatch: inferred type is DashboardFragment.Companion but Fragment was expected, everytime I enter any fragment in the replaceFragment function.
@ricardoferreira9868
@ricardoferreira9868 3 жыл бұрын
my bottomnavigationitemselectedlister not getting detected can you help ? or anyone?
@geraldmacias7037
@geraldmacias7037 3 жыл бұрын
It works perfectly, thank you so much!
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
Glad it helped!
@jopibr
@jopibr 2 жыл бұрын
THANK YOU MAN!!!! THANK YOU VERY MUCH!
@oscarrmh
@oscarrmh 3 жыл бұрын
Really amazing explanation, thanks, I have a question if I have a mainActivity with BottomNavigator, and I want in one of this fragments call others fragments what I will do?
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
I am glad that you liked the tutorial. You can create a "replaceFragment" function in one of your fragments and setOnNavigationItemSelectedListener to check if a button has been clicked. This would redirect your from one fragment to another fragment. Let me know if you face any difficulties in implementing in what you want!
@metime_me
@metime_me 2 жыл бұрын
it works! great, thanks ^_^
@dannygurkin6824
@dannygurkin6824 3 жыл бұрын
Hi I'm getting an unresolved reference error on bottom_navigation.setOnNavigationItemSelectedListener. Its saying bottom_navigation is an unresolved reference although I have referenced this on my activity_main.xml. Been looking all over for a fix and couldnt find anything. any help is appreciaterd thanks. Also great video!!
@pulkitarora2472
@pulkitarora2472 3 жыл бұрын
i am getting same error can some one please let me know
@dannygurkin6824
@dannygurkin6824 3 жыл бұрын
@No Spoiler Thanks this worked
@diasmashikov7793
@diasmashikov7793 3 жыл бұрын
@@dannygurkin6824 how did you work this out?
@pranshul..
@pranshul.. 2 жыл бұрын
I rewrote that and it worked 🤣
@ahdibiaimene3588
@ahdibiaimene3588 2 жыл бұрын
Thanks for your tutorial
@davidtzirima9301
@davidtzirima9301 3 жыл бұрын
great stuff man keep it up
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
Appreciate it!
@user-ob2ho3zm8b
@user-ob2ho3zm8b 16 күн бұрын
halo brother, perkenalkan saya dari indonesia, bolehkan anda menggabungkan Bottom Navigation Bar in Android Studio dengan sites google? jadi setiap icon sepereti dasboard atau setting di klik maka akan terbuka dan terhubung dengan page sites google, misalkan icon setting digantikan dengan prodak, maka page prodak akan terbuka pada sites google, thanks before, God bless...
@arashrostami3772
@arashrostami3772 2 жыл бұрын
hi my bottomnavigationview sometimes show the icons vertically insted of horisentally what should I do about this ?
@__A-st4tq
@__A-st4tq 3 жыл бұрын
Thanks for the amazing lecture!! What should I do if I want to use my own icon? like icon.png
@janvanoverbeek187
@janvanoverbeek187 3 жыл бұрын
Don't use PNG, but use SVG. This is because it scales perfectly without getting blurry and you can change the color ect. When adding a Vector Asset choose Local File and give up the path where the svg or psd is. Vector Asset will generate a xml from that svg :DD
@ChrisAthanas
@ChrisAthanas 3 жыл бұрын
Excellent demo
@somnathbera9004
@somnathbera9004 3 жыл бұрын
Thanks Mazn!
@joshuavirina4287
@joshuavirina4287 2 жыл бұрын
Hello why my setonNavigation clicklistener not be detected? Ang my itemId is red? Hopefully answer my question?
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
Hello Mr. Mazn! I am your subscriber. We thank you for your tutorial. I did all what you have told us and nothing shows me red but my apps doesn't appear if I type "replaceFragment(dashboardFragment)"... or (myFragment). When I delete it, all activities run smoothly except the bottom bar. In general I couldn't access my bottom navigation menu at all. It doesn't listen. If I insert the above word, my app will disappear from the emulator. Android Studio couldn't detect me where I missed it. Please help me.
@arslan2536
@arslan2536 2 жыл бұрын
did you solve the problem?
@ethiomusic3158
@ethiomusic3158 2 жыл бұрын
@@arslan2536 I solved it by then. Be blessed for your kind support. Or are you looking for help?
@maxhooker4186
@maxhooker4186 3 жыл бұрын
Which is the difference between using transaction.comit() and navigation component. you have a new susbcriber
@nilsgermain8103
@nilsgermain8103 2 жыл бұрын
Hi man i got a problem at 10min when i try to write bottom_navigation android studio underline red and i dont find bottom_navigation someone can help me plz ? i dont know why i cant link my bottom_navigation like you i got my ID bottom_navigation in the activity_main i dont why where the problem come from thanks for the answer and its a really nice tutorial
@kennethpacatang1177
@kennethpacatang1177 2 жыл бұрын
Why I can't call bottom navigation? help me please
@AdrianKilgour
@AdrianKilgour 2 жыл бұрын
This no longer works, full of deprecated code.
@mageshwaran9774
@mageshwaran9774 2 жыл бұрын
Thanks a lot Sir 😃 :-)
@mohammedalzamil7191
@mohammedalzamil7191 3 жыл бұрын
mazin habibi I laf u this is perfect thx
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
I am glad that you liked it habibi!
@jackmoreno2033
@jackmoreno2033 3 жыл бұрын
Help, I'm new to android (kotlin) programming. Why my bottom_navigation inside MainActivity.kt is not recognized? It is like no reference. What should be the issue? I am stuck at this part.
@012chris210
@012chris210 3 жыл бұрын
add " id 'kotlin-android-extensions' " in the plugins section in your build.gradle(:app) should fix it
@ethiomusic3158
@ethiomusic3158 3 жыл бұрын
​@@012chris210 Thank you so much. I got it. Everything is resolved.
@facttoyou2206
@facttoyou2206 2 жыл бұрын
setonnavigationitemselectedlistener ,This is showing me with cut over Idk how to solve this , pls help me any1?
@chesteirjudearmada7482
@chesteirjudearmada7482 2 жыл бұрын
The icons in nav bar doesnt appear. Why?
@duniapemula1794
@duniapemula1794 3 жыл бұрын
Sorry I want to ask sir how to display a RecyclerView on a Fragment
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
I have tutorial series on RecyclerView. I pretty much explain everything in that regard!
@MrJQ3d
@MrJQ3d 3 жыл бұрын
Hi, can i use activities instead fragments to navigate?
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
Try your best to use fragments instead of activities. Your app should have one activity and the rest should be fragments. This is what google recommends btw
@characterfactory889
@characterfactory889 3 жыл бұрын
What is google design material dependency ?
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
Sorry for the late response. Material Design UI are components for Android. It will help you to not build everything from scratch.
@chiragkumar1968
@chiragkumar1968 3 жыл бұрын
My bottom navigation hiding behind back/home button layout. What to do?
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
You might have problem with either constraints or margin top or bottom
@chiragkumar1968
@chiragkumar1968 3 жыл бұрын
@@CodeWithMazn yea it was by my side 😅 I put nav bar in fragment my mistake
@abhishekthakur8625
@abhishekthakur8625 3 жыл бұрын
I'm Beginner in Android studio. My debug'app' show me this error "AndroidStudioProjects\AppProject1\app\src\main\java\com\example\appproject1\MainActivity.kt: (21, 9): Unresolved reference: dashboard" My code override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) dashboard.setOnClickListener{item -> Toast.makeText(context, "DashBoard", Toast.LENGTH_SHORT).show() } }
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
Check out your dashboard text ID. Check if you are referencing the right ID
@Jlevk
@Jlevk 2 жыл бұрын
All is cool but my text is not showed
@lupuionut4689
@lupuionut4689 3 жыл бұрын
for me is not working , i have no errors i double check for the coding but is not working what so ever
@CodeWithMazn
@CodeWithMazn 3 жыл бұрын
What error do you get?
@digital-warrior9188
@digital-warrior9188 2 жыл бұрын
please put night mode
@elijah6846
@elijah6846 3 жыл бұрын
it doesn't work with view binding
@calibur5518
@calibur5518 2 жыл бұрын
setOnItemSelectedListener
Seekbar in Android Studio [Kotlin 2020]
6:44
CodeWithMazn
Рет қаралды 11 М.
Kids' Guide to Fire Safety: Essential Lessons #shorts
00:34
Fabiosa Animated
Рет қаралды 15 МЛН
Zombie Boy Saved My Life 💚
00:29
Alan Chikin Chow
Рет қаралды 11 МЛН
Challenge matching picture with Alfredo Larin family! 😁
00:21
BigSchool
Рет қаралды 42 МЛН
BOTTOM NAVIGATION VIEW - Android Fundamentals
16:53
Philipp Lackner
Рет қаралды 54 М.
Trying Out The Cosmic Desktop Environment ...
9:26
Michael Horn
Рет қаралды 3,7 М.
Bottom Navigation in Android Studio using Kotlin | Android Knowledge
16:25
Fragment to Fragment Communication in Android Studio [Kotlin 2020]
11:39