title: ArrayList to a String Array
body: <p>Given 3 variables (homeNumber,mobileNumber and workNumber), which can be null, but atleast one of those will be a String, I need to return a String array so I can use it later on an Android Dialog. I'm having troubles doing this. I tried doing it in an ArrayList and removing all null elements, which leaves an ArrayList with only Strings, like I want, but when trying to change it to an Array I get a ClassCast exception on the last line.                  </p>
  
  <pre><code>ArrayList numberList = new ArrayList();
  numberList.add(homeNumber);
  numberList.add(mobileNumber);
  numberList.add(workNumber);
  numberList.removeAll(Collections.singleton(null)); 
  
  final String[] items= (String[]) numberList.toArray();
  </code></pre>
  
  <p>Any ideas how to fix this?</p>