Please indent your code and use the code button; I went back to your code and added code tags and doesn't it look better now
Beware of passing arrays around. Arrays in Java® are always mutable and all it takes is one line of code saying myArray[i] = xyz; and you have broken your code everywhere you are using that array. You can copy arrays with their clone() method.
I don't know of a shuffling technique readily available in Java® (Android might be different) but you can shuffle Lists (link) or you can copy that technique to write your own shuffle() method.
Im using the collection.shuffle or the Fisher-Yates shuffle directly. The problem is that, if i call the shuffle() method inside the buttons class, reshuffles the answers everytime with result to have same answers in different buttons. Thats why i need to shuffle the array once (outside the button classes or maybe in different .java file) and then call the shuffled array indices one by one.
Your shuffle technique doesn't shuffle the array everywhere. If you only use one array and don't take copies of it, you only have one array and it has the same state everywhere. Not, “shuffle everywhere,” but, “shuffle once, see the result everywhere.” You need to take copies of the array wherever you use it.
Is that what you want? I would have thought take a copy of thee original array and shuffle the copy. Each object getting an array should copy it immediately. That way everywhere the array is used has its own copy and they will behave as independent of one another. The problem with global variables is that changes made to them are reflected everywhere.
Don't MAKE me come back there with this tiny ad:
SKIP - a book about connecting industrious people with elderly land owners