title: How to inflate multiple instances of same fragment in activity (gmap)?
body: <p>I've checked around and I see no one has asked exactly the question, since what people are doing is replacing fragments to show them one moment or another. Except <a href="https://stackoverflow.com/questions/15349816/adding-multiple-instances-of-the-same-fragment">this guy</a> who loaded 5 fragments of same instance inside a <code>LinearLayout</code>.</p>
  
  <p>What I'm trying to do is really simple, I want one activity that shows me 3 fragments (instances of same class, that inflate same layout).</p>
  
  <p>Everytime I instance my custom <code>Fragment</code> class I was inflating one xml with a <code>&lt;fragment/&gt;</code> that loads a map. At start, compiler told me <code>Duplicate id with another fragment</code> because that <code>&lt;fragment/&gt;</code> had same id in all 3 Fragments (it was the same xml being inflated).</p>
  
  <p>So I replaced <code>&lt;fragment/&gt;</code> to <code>&lt;FrameLayout/&gt;</code> (same id again), and loaded the map dynamically. I was expecting same error, but it didn't happen, issue is, it only shows first map (in third of the screen) and the other Fragments show nothing.</p>
  
  <p>What can I do to have in screen 3 maps, each of one in different fragment?</p>
  
  <p>Pdt: I've already tried loading maps with different tags, one per fragment. Didn't work.</p>
  
  <h1>EDIT</h1>
  
  <p>I just tried something, having in mind the issue was with the IDs. What I tried was adding an attribute to my custom class, <code>int mapId</code>, and I set it after instantiating the fragment with ids 1, 2 and 3 respectively.</p>
  
  <p>Now, in <code>onCreateView()</code> before returning the inflated view, I set the of the container <code>&lt;FrameLayout/&gt;</code> doing <code>frame.setId(frame.getId()+mapId);</code>... finally when loading dynamically the map in the container, I ask for the id <code>R.id.map+mapId</code>. And well, it worked:</p>
  
  <p><img src="https://i.stack.imgur.com/NY6kz.png" alt="Screenshot, same Fragment class, 3 different instances"></p>
  
  <p>Is that an acceptable or recommendable practice? pros/cons? What are the odds that modifying manually an id, it causes a conflict with another existing auto-generated ID?</p>