I don’t seem to be able to access Arrays.copyOfRange in my Android project in Eclipse Indigo 3.7.1 On Ubuntu 11.10.
My JRE is java-6-openjdk which I thought included Arrays.copyOfRange
For example, if I have this code:
int[] debug = new int[5];
int[] x = Arrays.copyOfRange(debug,0,4);
Eclipse tells me
The method
copyOfRange(int[], int, int)is undefined for the typeArrays
I don’t understand because the Android reference Arrays includes this method for Arrays.
Any ideas?
The method
Arrays.copyOfRange()wasn’t introduced until API level9. Make sure you are using that as the minimum SDK.Also, you are indexing incorrectly. In java if you have an array of size
5the indices range from0->4Change your code to this: