Home » Android » android – Load previous question in tabLayout (java)-Exceptionshub

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

Posted by: admin February 26, 2020 Leave a comment

Questions:

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&Answers: