Home » Android » Getting error in steppers

Getting error in steppers

Posted by: admin November 1, 2017 Leave a comment



public class StepFragmentSample extends Fragment implements Step {
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View v = inflater.inflate(R.layout.step, container, false);
        //initialize your UI
        return v;

    public VerificationError verifyStep() {
        //return null if the user can go to the next step, create a new VerificationError instance otherwise
        return null;

    public void onSelected() {
        //update UI when selected

    public void onError(@NonNull VerificationError error) {
        //handle error inside of the fragment, e.g. show error on EditText


public static class MyStepperAdapter extends AbstractFragmentStepAdapter {
    public MyStepperAdapter(FragmentManager fm, Context context) {
        super(fm, context);

    public Step createStep(int position) {
        final StepFragmentSample step = new StepFragmentSample();
        Bundle b = new Bundle();
        b.putInt(CURRENT_STEP_POSITION_KEY, position);
        return step;

    public int getCount() {
        return 3;

    public StepViewModel getViewModel(@IntRange(from = 0) int position) {
        //Override this method to set Step title for the Tabs, not necessary for other stepper types
        return new StepViewModel.Builder(context)
            .setTitle(R.string.tab_title) //can be a CharSequence instead       


public class StepperActivity extends AppCompatActivity {
    private StepperLayout mStepperLayout;

    protected void onCreate(Bundle savedInstanceState) {
        mStepperLayout = (StepperLayout) findViewById(R.id.stepperLayout);
        mStepperLayout.setAdapter(new MyStepperAdapter(getSupportFragmentManager(), this));

I have copied the above code from this link.}

While debugging, the control does not goes to createStep Method In StepFragmentSample.java

while debugging from mainActivity.java, the control goes to MyStepAdapter.java in that first MyStepperAdapter() method then to getCount() method but not to createStep(). why? please help me. and It does not giving any exception. The app shows “unfortunately stopped”.