Code example for ArrayList

Methods: sizetoArray

0
	 * Recreate the adapter that provides the data for the spinnner, 
	 * and assign it to the spinner each time an item is added/removed. 
	 */ 
	private void setSpinnerAdapter() 
	{ 
		ArrayList<String> itemsList = new ArrayList<String>();
		for (int i=0; i < m_children.size(); i++)
		{ 
			itemsList.add("DEFAULT");
		} 
		mStringItems = new String[itemsList.size()];
 
		// Convert to an array of objects. 
		itemsList.toArray(mStringItems);
 
		// Recreate adapter for the right number of items. 
		mAdapter = new CustomSpinnerAdapter(
						mContext,
						android.R.layout.simple_spinner_dropdown_item,
						mStringItems);
Experience pair programming with AI  Get Codota for Java