Q:

Android- method is permanently changing the value of variable

I have this method which I dont understand. 
2 global variables which are important for this questions:
-mNextButton;
-mCurrentIndex;
mNextButton.setOnClickListener(new View.OnClickListener() {
            @Override

            public void onClick(View v) {

              mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length;

             int questionID = nameOfArray[mCurrentIndex].getQuestion();
        mQuestionTextView.setText(question);
            }
        });

how is it possible that mCurrentIndex is increased permanently every time user clicks mNextButton?

A:

Try to be more specific. What do you really what to know? 
In your code you setup a callback, which will be called, when user press the button. Inside that code you updating your "global" variables (since java has no global variables, I will assume you mean class field variable inside activity) 
mCurrentIndex = (mCurrentIndex + 1) % mQuestionBank.length; 
this will update mCurrentIndex exactly as specific - it increase the index for one, and fold it, when the value increase more than mQuestionBank.length. % is a standard modulo operator. 
For gaining more understanding check out your mQuestionBank.length parameter or write a better question. Good luck. 

