Re-using Ids

Hello,



While trying to remove and then rebuild some Elements I went trought this warning :



Possible conflicting id [inhabitant_name] detected. Consider making all Ids unique or use #id in control-definitions.



Could someone please guide me on this issue?



This is what I do to remove the existing Element (which is contained in inhabitant_stats) :

[java]

List<Element> elements = nifty.getCurrentScreen().findElementByName(“inhabitant_stats”).getElements();

Iterator i = elements.iterator();

while (i.hasNext()){

Element element = (Element)i.next();

element.markForRemoval();

}

nifty.getCurrentScreen().findElementByName(“inhabitant_stats”).layoutElements();

[/java]



And here is my Element definition / rendering :

[java]

PanelBuilder line = new PanelBuilder();

line.backgroundColor("#666f");

line.width(“100%”);

line.height(“40px”);

line.id(“inhabitant_name”);

line.build(nifty, nifty.getCurrentScreen(), nifty.getCurrentScreen().findElementByName(“inhabitant_stats”));

[/java]



Those two steps are called in this order after I click on a button.



I even tried to set the ID at null in the removal step but doesn’t work either.



If any of you got a clue.



Have a nice day.