Android: create xml layout elements from external data
<p>So bare with me because this gets fairly complicated quickly.</p>

<p>I have a list of questions that require different elements for the answers. Specifically question 1 may have <code>checkbox</code> answers question 2 may have a <code>spinner</code> with an <code>array</code> of answers and question 3 may have an <code>EditText</code> so the user can type the answer.</p>

<p>The problem is until the data is passed to the application you don't know how many questions there will be and you don't know what format the answers will be in. So one survey might have 10 questions with 3 checkboxes, 3 spinners, and 4 edit texts and the next one might have 50 questions with half edit text half check boxes. Until the data comes in from a remote server with the survey questions/answers there is no way to know. </p>

<p>The questions will always be text views. 
However I am stumped on how to get the layout to inflate in real time answers with check boxes, spinners etc.The possible answers will have some type of identifier letting the application know they are check boxes, spinners etc.</p>

<p>If your still lost here is a quick and crude diagram</p>

<p><strong>survey1</strong></p>

<p>Q1) TextView
A1) 3 CheckBox answers</p>

<p>Q2) TextView
A2) 10 Spinner Answers</p>

<p>Q3) TextView
A3) EditText</p>

<p>now survey one is done and survey 2 is coming into the same activity, layout, fragment or whatever and it has this data</p>

<p><strong>survey2</strong></p>

<p>Q1) TextView
A1) 3 CheckBox answers</p>

<p>Q2) TextView
A2) 3 CheckBox answers</p>

<p>Q3) TextView
A3) 3 CheckBox answers</p>

<p>Q4) TextView
A4) 3 EditText answers</p>

<p>Q5) TextView
A5) 3 EditText answers</p>

<p>Q6) TextView
A6) 3 EditText answers</p>

<p>So you see the problem? I can't simply make a layout with a listview, or 3 checkboxes or 3 textViews and feed them data because I don't even know what types of fields or how many I'll need. 
I know this is not an easy question and may need more information. It's just something I've been trying to wrap my head around the logic behind and I simply don't know of any way to do this.</p>
