Offset Null Entertainment, LLC Software and Graphic Design Solutions

Turn an ArrayList into an Array

In Java and Android, Arrays have a fixed length. Coming from Perl and PHP where arrays can grow and shrink without needing to be redefined, this concept presented challenges while defining arrays. Enter the ArrayList. Unlike Java's and Android's Arrays, whose size doesn't change, you can add or remove elements in an ArrayList dynamically.

However, several of the methods I'm using require Arrays and not ArrayLists. You may also want to convert an ArrayList to an Array because some operations can be faster with an Array. Fortunately, there's a simple call that will convert an ArrayList to an Array, here's how: