0
Eae personal, I have an application that works normally in all versions of Android, however in Android 9.0 (Pie) starts everything normal displaying the Splash Screen but when going to Mainactivity the application closes and does not display any error message, I’ve tried everything but nothing works, I need your help.
//MainActivity
public class MainActivity extends AppCompatActivity {
private TabLayout tabLayout = null;
private ViewPager viewPager = null;
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
tabLayout = (TabLayout) findViewById(R.id.tab_layout);
viewPager = (ViewPager) findViewById(R.id.viewPager);
//setting the tabs title
tabLayout.addTab(tabLayout.newTab().setText("Ao Vivo"));
tabLayout.addTab(tabLayout.newTab().setText("Notícias"));
tabLayout.addTab(tabLayout.newTab().setText("WebTV"));
//setup the view pager
final PagerAdapter adapter = new app.com.portalcentrooeste.adapters.PagerAdapter(getSupportFragmentManager(),tabLayout.getTabCount());
viewPager.setAdapter(adapter);
viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayout));
tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
@Override
public void onTabSelected(TabLayout.Tab tab) {
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(TabLayout.Tab tab) {
}
@Override
public void onTabReselected(TabLayout.Tab tab) {
}
});
}
Has called some Activity out of the main Activity?
– Murillo Comino
No, I just call the tablayout frames .
– Douglas Alves
Look at the logcat. Surely you will have the error stack there.
– Cícero Moura