Bottom navigation part 2 in Android using Kotlin:

Bottom navigation
Step 1.  Add Framelayout in Layout File
Step 2. Create  fragment in android studio for your app
Step 3. How to use fragmentmanager to use fragment in your app

Load fragment in app on BottomNavigationView event 

Steps1. create new fragment->fragment blank of h fragment.kt and another of create aboutfragment.kt
Step2. fragment_home_xml-> attributes-> text-> I am  home fragment
 Step3. fragment_about_xml-> attributes-> text-> I am about fragment

Go to MainActivity.kt (code)

supportFragmentManager.begin Transaction ().add(R.id.root_container,HomeFragment()).commit()
Bottomview.setOnNavigationItemSelectedListener( 

/*Part one logic
Val msg= when(it.itemID)
{
R.id.about->”About Selected”
else ->”Home selected”
}
Toast.make text(this @MainActivity,msg,Toast.LENGTH_LONG).show() /*

Val fragment=when(it.itemId)

R.id.about->AboutFragment()
   else->HomeFragment ()
}

SupportFragmentManager.begin Transaction ().replace(R.id. root_container, fragment).commit()
True 
}
}
}

16 thoughts on “Bottom navigation part 2 in Android using Kotlin:”

  1. john wick says:

    Fabulous, what a webpage it is! This webpage presents useful information to us, keep it up. Corissa Wait Rosalynd

  2. porno says:

    Absolutely composed written content , thanks for information . Carola Micky Xanthus

  3. sikis says:

    Hello colleagues, how is all, and what you wish for to say regarding this article, in my view its genuinely remarkable in favor of me. Dollie Rafe Vanni

  4. sikis says:

    I real happy to find this web site on bing, just what I was looking for : D besides saved to favorites. Millicent Lezley Diao

  5. sikis says:

    I go to see everyday some sites and sites to read content, except this weblog presents quality based articles. Octavia Igor Liu

  6. web-dl says:

    Well I truly enjoyed studying it. This information provided by you is very helpful for correct planning. Evonne Tyson Bartolemo

  7. yify says:

    Well I really enjoyed reading it. This tip procured by you is very effective for correct planning. Karoly Elroy Gothart

  8. bedava says:

    Good article! We will be linking to this great post on our website. Keep up the good writing. Alison Ara Raybin

  9. yify says:

    This piece of writing provides clear idea designed for the new visitors of blogging, that genuinely how to do blogging and site-building. Vally Benjamin Rather

  10. bluray says:

    There is certainly a lot to find out about this topic. Vilhelmina Artie Jade

  11. ucretsiz says:

    I am genuinely grateful to the holder of this website who has shared this impressive post at here. Robinetta Sanford Matteo

  12. yify says:

    I think this is a real great blog post. Fantastic. Moselle Ethelbert Lash

  13. indir says:

    Some genuinely superb blog posts oon this website, thank you for contribution. Kirstin Dev Varipapa

  14. bluray says:

    Excellent article. I will be facing some of these issues as well.. Gerta Huntington Leonie

  15. bluray says:

    I appreciate, lead to I discovered just what I was taking a look for. Candy Pavlov Dilks

  16. indir says:

    Howdy very nice website!! Man .. Beautiful .. Amazing .. Zena Rube Matthiew

Leave a Reply

Your email address will not be published. Required fields are marked *