Android: How to add multiple of the same fragment using a loop
<p>I am fairly new to android development, and I'm trying to make a small app that lists names with a few action buttons placed beside each name. My plan was to loop through the list of names, and add a fragment for each one, forming a list of them on the screen.</p>

<p>Right now I was trying to test out the following code. I want to add the fragment "fragTest", to "fragPlaceHolder" in the activity.</p>

<p>This is what my code looks like:</p>

<pre><code>//Begin the transaction
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

//Replace the contents of the container with the new fragmentTest
for (int i = 0; i &lt; listLength; i++){
      ft.add(R.id.fragPlaceHolder, new fragmentTest());
}

//Complete the changes
ft.commit();
</code></pre>

<p>However when I do this, only one fragment ever seems to be added. And if it did work, how would I pass a name as an argument?</p>