8

Why is my startActivityForResult() returning null when converting ArrayList<String> to String[]?

view full story
linux-howto

http://stackoverflow.com – The following code is throwing a NullPointerException because the ArrayList isn't being converted to an Array correctly. The array is supposed to be passed to another activity. This works because I can pass a regular String[] but when I try to convert an ArrayList to Array I get the error. What's the right way to convert ArrayList to Array? String[] tmpHtml = new String[(siteElements.size())]; tmpHtml = (String[]) siteElements.toArray(); Intent returnResult = new Intent(); returnResult.putExtra("elements", tmpHtml); (HowTos)