This is probably a question with a blindingly obvious answer. I just can't see it, and will probably feel very small when someone points it out to me clearly.
I'm using Android at the Eclair MR1 level, so my Android Manifest has:
<uses-sdk android:minSdkVersion="7" />
In my MainActivity, I have a byte[] that I want to realloc to a larger size.
Java SE 6 has the java.util.Arrays class with static methods to do that for every elementary type. I can see that class documented in the android docs at http://developer.android.com/reference/java/util/Arrays.html#copyOf%28byte[],%20int%29
Here's my code:
byte [] padToLength (byte[] plain) {
try{
byte[] plainpad2 = java.util.Arrays.copyOf(plain, plain.length+10); //why won't this compile?
} catch (Exception e) {
}
But when I use that, I get a compilation error in Eclipse, saying "the method copyOf(byte[], int) is undefined for the type Arrays.
Can anyone suggest what I am doing wrong?
System.arraycopy (Object src, int srcPos, Object dst, int dstPos, int length)in stead.