This is the Stringarray from my xml file declared:
Resources res = getResources();
final String[] list = res.getStringArray(R.array.myArray);
The onSaveInstanceState Code looks like this:
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putStringArrayList("list", R.array.myArray);
}
/* Gives me this error :Wrong 2nd argument type. Found: 'int', required:
'java.util.ArrayList<java.lang.String>'. . . */
What is missing , what is wrong , I dont understand, I tried many different conjunctions of how to call myArray, didnt work, if you need additional information let me know.
Android Studio is trying to help me but I dont know how to write this ?
you can convert your array into list and then can pass it as the second argument like this:
List<String> arrayList = Arrays.asList(list);
outState.putStringArrayList("list", (ArrayList<String>) arrayList);