Referred to almost all the similar type of question;didn't found the answer.
NOTICE:I have an error at line 26
Cannot resolve method'setUpWithViewPager(androidx.viewpager.widget.ViewPager)'
Here, On line 5
I have imported TabLayout
and NOT TableLayout
On writing the code at line 16
I get an unexpected error which on hovering says
Unexpected implicit cast to TabLayout:layout tag was TableLayout
and when i change TabLayout
to TableLayout
the error at line 16
vanishes BUT error at line 26 stays and as per Cannot resolve method tabLayout.setupWithViewPager(viewPager)
I need to change Table Layout to Tab Layout.Which brings me to "square 1 again".
Here,is my XML file activity_intro
Cannot resolve method'setUpWithViewPager(androidx.viewpager.widget.ViewPager)'
The right method is:
tabLayout.setupWithViewPager(viewPager);
instead of
tabLayout.setUpWithViewPager(viewPager);
implicit cast to TabLayout:layout tag was TableLayout
In your layout you have to use the component:
<com.google.android.material.tabs.TabLayout
...>
<com.google.android.material.tabs.TabItem/>
</com.google.android.material.tabs.TabLayout>