Hi,
mPreviousButton = (Button) findViewById(R.id.previous_button);@Override 
        }
    }); 
            
              
            
           
          
            
            
              Hi!, I’m Chinese student. Maybe my English is poor,but I want to help you.
if(mCurrentIndex == 0)
 {
        mCurrentIndex= mQuestionBank.length - 1;
  }
   else
    mCurrentIndex = (mCurrentIndex - 1) % mQuestionBank.length;
  updateQuestion(); 
            
              4 Likes 
            
            
           
          
            
            
              Thank you for your help, I appreciate it.
             
            
              
            
           
          
            
            
              another example of a solution:
             
            
              1 Like 
            
            
           
          
            
            
              hi,I’m Chinese student. Maybe my English is poor,but I want to help you.And I have a another idea.@Override 
             
            
              
            
           
          
            
            
              I choose to +4 .As you can see, the code is short,but it can work well.
             
            
              
            
           
          
            
              
                KTBFFH  
              
                  
                    September 26, 2018,  2:57am
                   
                  7 
               
             
            
              Great solution!
For anyone confused, the issue with this code:
mCurrentIndex = (mCurrentIndex - 1) %mQuestionBank.length; 
is that if mCurrentIndex starts out as 0 the value in the parenthesis go to -1 and then the mod calculation throws an error and ends the program.
             
            
              
            
           
          
            
              
                lbfb  
              
                  
                    December 8, 2018,  6:23am
                   
                  8 
               
             
            
              I also like this solution. It is essentially the same as marfars but is better because it allows you to also change the size of the array of questions.
             
            
              
            
           
          
            
            
              hi
             
            
              
            
           
          
            
            
              Excellent solution. I love short code.
             
            
              
            
           
          
            
            
              
Should be the accepted answer as it work for every case unlike
(mCurrentIndex + 4) % mQuestionBank.length; and
 `if(mCurrentIndex == 0)
 {
        mCurrentIndex= mQuestionBank.length - 1;
  }`
which will only fetch the last Question every time. Cheers to John_Doe.