मेने भी अपने app में bottom navigation के साथ fragments का use लिया पर मेरा app बार बार क्रैश हो रहा है इसका कुछ सलूशन पता हो तो बताना ,मेने हर एक fregment में api calling के through data load करवाया है जब data जल्दी load हो जाता है तब app क्रैश नहीं होता है पर जब धीरे load होता है या नहीं होता है तब app क्रैश हो जाता है इसका कुछ उपाय हो तो बताना
please help me , i only need 2 buttons for this project and i folloed your steps. On the emulator it shows 4 buttons 2 same pairs but on the xml file there is only one pair and the layout i want
binding.bottomNavigationView.setOnItemSelectedListener(item -> { if (item.getItemId() == R.id.learn) { replaceFragment(new LearnFragment()); } else if (item.getItemId() == R.id.game) { replaceFragment(new GameFragment()); } else if (item.getItemId() == R.id.profile) { replaceFragment(new ProfileFragment()); } else { replaceFragment(new SettingFragment()); } return true; }); here the example to solve the problem. just use if statement
change it to name of the class next to name of xml activity Binding for example if the xml file name is avtivity_editable the binding name will be ActivityEditableBinding not ActivityMainBinding
@@taisiaapakina8115 edit file res=>values=>colors.xml, two colors are given there, in the image and likeness, you add the colors that you need, if you don’t master it, then you climbed here early)
I can run the app smoothly, but when I log login my app doesn't show the fragment already been designed as in the video, I also converted the switch into if, it shows no problem, someone please help me.
I dont know why but in starting and cant able to use binding.bottomNavigationView.setOnClicklistner Isme bottomnavigtionview use ni ho para pata ni kyu 😢😢😢😢😢
If your activity name is MainActivity then it will be ActivityMainBinding but for example if your activity name is LoginActivity it will be ActivityLoginBinding. You have to call binding according to the activity with it's respective layout file
Thank you!! You don't have idea, how your video helped at my project preparation work...
Excellent
Very good
It is perfect, perfect!
Nice video, awesome explanation, it works perfect on my app!
Very clear tutorial.
Thx a lot legen :)
Thx bro
What if you need to have multiple activities? Do you just copy the bottom menu to that new activity?
yes 100%
No, you need to use fragments
@@nguyendcb figured it out by now but thx lol
Thankyou sirrrrrrr
My panel buttons do not switch, that is, when switching, the home button is always active. Help me, please
I want as soon as I enter the app, the profile fragment will appear and the profile icon under the bottom bar will light up, how can I do that?
in my studio bottomNavigationView Not show Please Help
7:23
Error: constant expression required. In my switch case
please help
@@gitauyganjo7257 use if - else if
like that:
binding.bottomNavigationView.setOnItemSelectedListener(item -> {
if (item.getItemId() == R.id.home) {
replaceFragment(new HomeFragment());
}
else if (item.getItemId() == R.id.settings) {
replaceFragment(new SettingsFragment());
}
else if (item.getItemId() == R.id.profile) {
replaceFragment(new ProfileFragment());
}
return true;
});
Hello, were you able to solve it?
@@El_Master533 yes. I just changed the switch case to an if else statement
mine has the same error, can you help me?
thanks bro!
Guys btw if the contents are not appearing remember to set the top constraint as well for FrameLayout 2:34
Thanks bro
thanks for the assist, was starting to drive me nuts
спасибо, бро!!! Очень сильно помог!!!
मेने भी अपने app में bottom navigation के साथ fragments का use लिया पर मेरा app बार बार क्रैश हो रहा है इसका कुछ सलूशन पता हो तो बताना ,मेने हर एक fregment में api calling के through data load करवाया है जब data जल्दी load हो जाता है तब app क्रैश नहीं होता है पर जब धीरे load होता है या नहीं होता है तब app क्रैश हो जाता है इसका कुछ उपाय हो तो बताना
please help me , i only need 2 buttons for this project and i folloed your steps. On the emulator it shows 4 buttons 2 same pairs but on the xml file there is only one pair and the layout i want
💚
thank you
Error: constant expression required. In my switch case. someone help me?
you need to use if/else statements
@@matze_5737how
@@matze_5737 legendary comment. This solved my problem also
bro iam getting a Constant expresstion required for the switch case R.id.home i did same as u but its showing error, can u help with this...
Did you find the answer?
found a solution just use if instead switch
binding.bottomNavigationView.setOnItemSelectedListener(item -> {
if (item.getItemId() == R.id.learn) {
replaceFragment(new LearnFragment());
} else if (item.getItemId() == R.id.game) {
replaceFragment(new GameFragment());
} else if (item.getItemId() == R.id.profile) {
replaceFragment(new ProfileFragment());
} else {
replaceFragment(new SettingFragment());
}
return true;
});
here the example to solve the problem. just use if statement
@@alo_lolago to switch click alt+ enter then choose if . Problem will be solved
@@alimishazwan3687 thanks bro
Everything went well, until the ActivityMainBinding. Good tutorial though.
change it to name of the class next to name of xml activity Binding
for example if the xml file name is avtivity_editable the binding name will be ActivityEditableBinding not ActivityMainBinding
@@castero465 Thank you mate, i had a typo in the binding name, now it works.
@@castero465 sorry bro i didn't understand i even didn't see where author made the class next to name of xml activity Binding
thank you, it works on me
It doesn't work, no fragment is displayed not even the default Home fragment, i have changed the switch to if
Someone help me, the screens are not changing. they are all white since I defined colors etc😓
Thanks for the Solution , becouse In some rare cases, switching from switch-case to if-else can help.
la parte de arriba del botton navigation se puede quitar
buildFeatures { viewBinding True }
My viewBinding doesn't show in purple
have you figured out how to fix it? I have an error with this connection
@@taisiaapakina8115 edit file res=>values=>colors.xml, two colors are given there, in the image and likeness, you add the colors that you need, if you don’t master it, then you climbed here early)
you need to have a groovy gradle build had same problem
Cannot resolve method 'getItemId' in 'View' how to resolve this
I can run the app smoothly, but when I log login my app doesn't show the fragment already been designed as in the video, I also converted the switch into if, it shows no problem, someone please help me.
same problem
@@neoplasia536 I've change the framelayout in Activity_Main into this and my code can run
What do you see where the fragmentLayout is ?
@@johnk.849 I have the same problem, I just see a white screen and the top bar with the time is slightly cut off.
you can try to fix the height and width of FrameLayout to match_parent, i tried and succeeded
can't process with MainActivity- code problem
What error are you getting ?
I have applied all vector asset but after adding in bottom navigation it is giving me home icon
Home icon for all bottom nav items ??
@@johnk.849 yes but it's solved now.
Someone help me, the screens are not changing. they are all white since I defined colors etc😓
@@Gustavo_788 it is beacause home icon - white.
android:background="@color/black"
app:itemTextColor="@color/white"
app:itemIconTint="@color/white"
very fast; quickly
Help me my gradle is kotlin
How do I contact you. Please respond.
if you have more then 3 items there will be problème
What problem do you strike when you have more than 3 items ?
switch required integer
Use it if
wow thx for the tutorial but now i made sure of that android development is a huge joke
Could be better if you provide the scripts
This.
@@JSchwift where?
JAVA? In 2023? 🤣🤣🤣🤣🤣🤣
I work in java, so it's necessary anyway.
@@kenny.mesquita Could be necessary, but not in Android development.
@@Attee_Q so I'm a android developer, and I worK with java.
@@kenny.mesquita Time to change to Kotlin.
@@Attee_Q Give me a link of your Application, Time to change in kotlin 😂😂
I dont know why but in starting and cant able to use binding.bottomNavigationView.setOnClicklistner
Isme bottomnavigtionview use ni ho para pata ni kyu 😢😢😢😢😢
If your activity name is MainActivity then it will be ActivityMainBinding but for example if your activity name is LoginActivity it will be ActivityLoginBinding.
You have to call binding according to the activity with it's respective layout file
Set on click listener nhi call karna hai set on selected item method call hoga
@@leychelle thx 👍
@@leychelle I have same problem my activity name is pat_home and my layout name is pathome.xml
thank you you are a life saver for real@@leychelle