content: package de.androidcrypto.android_hce_beginner_app;
  
  import android.content.ComponentName;
  import android.content.Intent;
  import android.content.pm.PackageManager;
  import android.nfc.NfcAdapter;
  import android.nfc.cardemulation.CardEmulation;
  import android.os.Bundle;
  
  import androidx.activity.EdgeToEdge;
  import androidx.appcompat.app.AppCompatActivity;
  import androidx.core.graphics.Insets;
  import androidx.core.view.ViewCompat;
  import androidx.core.view.WindowInsetsCompat;
  import androidx.fragment.app.Fragment;
  
  import com.google.android.material.bottomnavigation.BottomNavigationView;
  import com.google.android.material.navigation.NavigationBarView;
  
  public class MainActivity extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          EdgeToEdge.enable(this);
          setContentView(R.layout.activity_main);
          /*
          ViewCompat.setOnApplyWindowInsetsListener(findViewById(R.id.main), (v, insets) -> {
              Insets systemBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
              v.setPadding(systemBars.left, systemBars.top, systemBars.right, systemBars.bottom);
              return insets;
          });
  
           */
  
          BottomNavigationView bottomNav = findViewById(R.id.bottom_navigation);
          //bottomNav.setOnNavigationItemSelectedListener(navListener);
          bottomNav.setOnItemSelectedListener(navListener);
  
          // as soon as the application opens the first
          // fragment should be shown to the user
          // in this case it is algorithm fragment
          getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, new HomeFragment()).commit();
              }
  
      private final NavigationBarView.OnItemSelectedListener navListener = item -> {
          // By using switch we can easily get
          // the selected fragment
          // by using there id.
          Fragment selectedFragment = null;
          int itemId = item.getItemId();
          if (itemId == R.id.home) {
              selectedFragment = new HomeFragment();
          } else if (itemId == R.id.read) {
              selectedFragment = new ReadFragment();
          } else if (itemId == R.id.write) {
              selectedFragment = new WriteFragment();
          }
  
          // It will help to replace the
          // one fragment to other.
          if (selectedFragment != null) {
              getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container, selectedFragment).commit();
          }
          return true;
      };
  
  
  }