46.8 Performing the Initialization Tasks
The remaining tasks involve initializing the TabLayout, ViewPager2 and TabStateAdapter instances. Edit the MainActivity.java file so that it reads as follows:
package com.ebookfrenzy.tablayoutdemo;
.
.
import android.net.Uri;
import androidx.viewpager2.adapter.FragmentStateAdapter;
import com.google.android.material.tabs.TabLayoutMediator;
import com.google.android.material.tabs.TabLayout;
.
.
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
.
.
configureTabLayout();
}
protected void configureTabLayout() {
for (int i = 0; i < 4; i++) {
...