The name of the array as a method parameter

I'm trying to create a private void method where I extract data from arrays. One of the method parameters is the array name.

getResources().getStringArray(R.array.arrayName));

Android Studio cannot resolve symbol “arrayName”. How do I correctly enter a parameter in a method?

Upvotes: 0

Views: 55

Answers (1)

Alexey Bilousov
Alexey Bilousov

Reputation: 116

Try to send arrayId instead arrayName

loadArray(R.array.arrayName);

private void loadArray(int arrayId) {

}

Upvotes: 1

Related Questions