I am stuck with this problem and I am not getting any solution to that, I want a tablayout with viewpager2 which has recycler view inside it. MainActivity.kt:-
@RequiresApi(Build.VERSION_CODES.Q)
override fun onCreate(savedInstanceState: Bundle?) {
      super.onCreate(savedInstanceState)
    binding = ActivityMainBinding.inflate(layoutInflater)
    setContentView(binding.root)
    pager = findViewById(R.id.view_pager)
    tab = findViewById(R.id.extra)
    val adapter = SectionsPagerAdapter(supportFragmentManager, lifecycle)
    pager.adapter = adapter
    TabLayoutMediator(tab,pager){tab,position ->
    when(position){
        0->{
            tab.text="RECENT"
        }
        1->{
            tab.text="SAVED"
        }
        2->{
            tab.text="TOOLS"
        }
    }
    }.attach()
SectionPagerAdapter.kt:-
  class SectionsPagerAdapter(fragmentManager: FragmentManager, lifecycle: Lifecycle):
    FragmentStateAdapter(fragmentManager, lifecycle) {
override fun getItemCount(): Int {
    return 3    }
      override fun createFragment(position: Int): Fragment {
          // return a particular fragment page
          return when (position) {
              0 -> {
                  return tabrecentFragment()
              }
              1 -> {
                  return tabsavedFragment()
              }
              2 -> {
                  return tabtoolsFragment()
              }
              else -> {
                  return tabrecentFragment()
              }
          }
      }     
    }
I am getting error-: Installation failed due to: ''package install-create -r -t --user current --full --dont-kill -S 7376065' returns error 'Unknown failure: cmd: Can't find service: package'' Retry Failed to launch an application on all devices.
And when I connect my android device to run the app then it gives the error:-
Caused by: java.lang.NullPointerException: findViewById(R.id.extra) must not be null at com.whatsappstatussaverlatest.MainActivitySSW.onCreate(MainActivitySSW.kt:125)
If you have any solution then please help
