title: To use BottomNavigationView in another class, i.e., not in MainActivity.kt
body: <p>I don't know much about Java, Kotlin, and Android. I need to create a BottomNavigationView in AddFragment class (related to fragment_user_data.xml). Is this possible?
  The codes I'm trying to include in an app are:</p>
  <pre><code>class MainActivity : AppCompatActivity() {          
    override fun onCreate(savedInstanceState: Bundle?) {
      super. onCreate(savedInstanceState)
      setContentView(R.layout.fragment_user_data)
  
      val firstFragment = FirstFragment()
      val secondFragment = SecondFragment()
      val thirdFragment = ThirdFragment()
  
      setCurrentFragment(firstFragment)
  
      bottomNavigationView.setOnNavigationItemSelectedListener {
        when(it.itemId) {
          R.id.miHome -&gt; setCurrentFragment(firstFragment)
          R.id.miMessages -&gt; setCurrentFragment(secondFragment)
          R.id.miProfile -&gt; setCurrentFragment(thirdFragment)
        }
        true
      }
     }
  
   private fun setCurrentFragment(fragment: Fragment) =
   supportFragmentManager.beginTransaction().apply {
     replace(R.id.flFragment, fragment)
     commit()
   }
  }
  </code></pre>
  <p>My AddFragment class already contains:</p>
  <pre><code>class AddFragment : Fragment() {
  
    override fun onCreateView(
      inflater: LayoutInflater, container: ViewGroup?,
      savedInstanceState: Bundle?
     ): View? {
      // Inflate the layout for this fragment
      val view = inflater.inflate(R.layout.fragment_user_data, container, false)
  
      mUserViewModel = ViewModelProvider(this).get(UserViewModel::class.java)
  
      view.add_btn.setOnClickListener {
          func_1()
      }
  
      return view
    }
  
    private fun func_1() {
  
    }
  
    private fun func_2() {
  
    }
  
  }
  </code></pre>