KyawLinnThant
KyawLinnThant

Reputation: 617

View Pager scrollable false

I have viewPager with 2 fragments of user complete profile, what my problem is I dont want to let the user to swipe the second fragment of my view pager unless user completes the first profile fragment. My aim is user must fill the first profile fragment and click confirm button then my view pager will swipe the second fragment.

Upvotes: 0

Views: 145

Answers (2)

Chintak Patel
Chintak Patel

Reputation: 768

you can use this link https://stackoverflow.com/a/9650884/6549856 can create custom ViewPager which will disable swipe gestures and after it, you can make call to your second fragment as

btn_confirm.setOnClickListener(new View.OnClickListener{

    @Override
    public void onClick(View v){
        viewPager.setCurrentItem(1,true);
    }
});

Upvotes: 0

Insane Developer
Insane Developer

Reputation: 1102

You can use StepperView for your purpose. Kindly go through this library. You can add a form validation on button on first page, if validation satisfies, then step into next step. Android Material Stepper

Upvotes: 0

Related Questions