How can I copy a CharArrayBuffer to another CharArrayBuffer at a specified index in Java on Android?
developer.android.com/reference/android/…
CharArrayBuffer stringBuffer1 = new CharArrayBuffer(128);
System.arraycopy("Phone", 0, stringBuffer1.data, 0, "Phone".length());
But i get an ArrayStoreException. I have allocated the CharArrayBuffer to be 128. I don’t understand this exception
from the docs
Copies an array from the specified source array, beginning at the specified position, to the specified position of the destination array.
ArrayStoreException
Thrown to indicate that an attempt has been made to store the wrong type of object into an array of objects. For example, the following code generates an
ArrayStoreException:following line of code
is trying to put String into
CharArrayBuffer.