Use textview with a tabLayout


#1

hello everybody :slight_smile:
I create a tabLayout which allow myself to switch of windows and it works. I would like to display a textView, so I create one, but when I put :
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)

    val fragmentAdapter = MyPagerAdapter(supportFragmentManager)
    viewpager_main.adapter = fragmentAdapter
    tabs_main.setupWithViewPager(viewpager_main)

    indicator_info = findViewById<TextView>(R.id.indicator_info)
    indicator_info!!.setText("Hello")

}
my app shutdown itself because of the line : indicator_info!!.setText(β€œHello”).
Have you got a idea of the problem ?

    thanks

#2

Do you have the logcat dump to see what kind of error you get?