Ваш вопрос не совсем понятен, я думаю, вы хотите, чтобы при нажатии Button
где-то сохранялось Array
(activityNames
). Вы можете сделать это таким образом, если я правильно понял:
class YourClass { //almost surely it extends Activity (or AppCompatActivity)
private List<String> thePlaceWhereTheArrayWillBeLocated = new ArrayList<String>(); //You should define a class varibale where the result of saveBtnYesFunc will ends up (I think that the content is of String type)
... onCreate(...) {
super.onCreate(savedInstanceState);
...
...
saveBtnYes.setOnClickListener(new View.OnClickListener() { //I don't know if it's inside the onCreate, but it could be here
@Override
public void onClick(View v) {
thePlaceWhereTheArrayWillBeLocated = saveBtnYesFunc(currentYesBtnId); //Maybe some type casts are needed
//tempActivityList =activityNames;
//return activityNames; //This line is totally incorrect
}
});
}
void wheneverFunctionYouWant() {
//do whatever you want with thePlaceWhereTheArrayWillBeLocated
}
}