Sunday, 27 May 2012

How to convert string type ArrayList to string Array

Here the below code is used to convert list of string object(ArrayList with String) to String Array(String[ ])

using toArray( ) method on ArrayList object we can convert arraylist to string[]

ArrayList<String> number_list = new ArrayList<String>();

number_list .add("one");
number_list .add("two");
number_list .add("three");

String[] numberArr = new String[number_list .size()];

numberArr = number_list.toArray(numberArr );

No comments:

Post a Comment

Android SQLite Database Viewer or Debuging with Stetho

Every Android Developer uses SQLite Database to store data into the Android Application data. But to view the data in SQLite have a lot of...