M
M
Max Khimenko2016-07-23 07:53:06
Android
Max Khimenko, 2016-07-23 07:53:06

How to correctly call tabs in an Android application?

www.fandroid.info/kak-sozdat-vkladki-tablayout.. watched this lesson! Everything worked out, but I have a question: How to make it so that another xml would open by flipping, not peoplefragment.xml, but for example peoplefragment2.xml, I'm just learning Java and would like to figure it out!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vlad Kovalev, 2016-07-23
@max_nakamura

Create any other fragment like PeopleFragment2 and in setupViewPager change PeopleFragment to your fragment.

private void setupViewPager(ViewPager viewPager) {
        ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager());
        adapter.addFragment(new PeopleFragment(), "People");
        adapter.addFragment(new PeopleFragment2(), "Group");   //PeopleFragment2
        adapter.addFragment(new OtherFragment3(), "Calls");    //Любой другой фрагмент
        viewPager.setAdapter(adapter);
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question