你至少试过这个吗?
Button[] CreatingButtons(int n, List names) { //your code... return Buttons; // return the Button array } // blablabla Button[] getTheButtonArrayHere = CreatingButtons(someIntVariable, someListOfStringVariable);