android – Load previous question in tabLayout (java)-ThrowExceptions

Exception or error:

Load previous question on tabLayout using viewPager in android studio

 // get previous question
private void getPreviousQues() {
    if (questionCounter < questionCounterTotal){
        currentQuestion = questionList.get(questionCounter);
        answered = true;
        questionCounter--;
        if (questionCounter < questionList.size()) {
            tabLayout.getTabAt(questionCounter).select();
        } else if (questionCounter == questionList.size())
            Toast.makeText(this, "ss", Toast.LENGTH_SHORT).show();
    }else {
        Toast.makeText(this, "Sorry ", Toast.LENGTH_SHORT).show();
    }

}
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *