Wednesday , June 22 2022

Bottom Navigation Android Example using Fragments – Android Coding by DMTechnolab

The package The trap.Simplified coding.bottomnavigationexample;

Import Android..Bundle;

Import Android.Support.Annotation.No no;

Import Android.Support.The design.Widget.Bottom view;

Import Android.Support.v4.App.Cut into pieces;

Import Android.Support.v7.App.AppCompatActivity;

Import item;

// Apply the interface OnNavigationItemSelectedListener to your activity class

public class Main activity Is spread AppCompatActivity come into force Bottom view.OnNavigationItemSelectedListener {{

@ Override

Protected Zero Go ahead()Bundle saveInstanceState) {{

Super.Go ahead()saveInstanceState);


// default piece loading

burden()New Homograph()));

// Getting the navigation view below and engaging the listener

Bottom view Navigation = findViewById()R.Id.Navigation);



@ Override

public Boolean onNavigationItemSelected()@Nonal menu item item) {{

Cut into pieces The piece = Invalid;

to switch ()item.getItemId())) {{

matter R.Id.Navigation_home:

The piece = New Homograph());


matter R.Id.Navigation_dashboard:

The piece = New Dashboard fragment());


matter R.Id.Navigation:

The piece = New Notifications());


matter R.Id.Navigation_profile:

The piece = New Profile fragment());



The return burden()The piece);


Private Boolean burden()Denial The piece) {{

// switching piece

If ()The piece ! = Invalid) {{



.To change()R.Id.Slicer, The piece)


The return True;


The return false;



Source link

About dmtechnolab

Check Also

Simplified Coding

Android Hilt Tutorial – Injecting Dependencies with Hilt – Android Coding by DMTechnolab

You are welcome Android Hilt tutorial. I hope you all are aware of it Dependency …

Leave a Reply

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