title: AndEngine - How to handle onAreaTouched of a Sprite after adding it to a collection of sprites?
body: <p>I have a collection of sprites in a <code>Map</code></p>
  <pre><code>private Map&lt;String, Sprite&gt; sprite = new HashMap&lt;String, Sprite&gt;();
  </code></pre>
  <p>and all i need is to subscribe to their <code>onAreaTouched</code> event.</p>
  <p>My attempt was something like this:</p>
  <pre><code>Sprite aSprite = new Sprite(i*128, 100, region.get(&quot;regionB&quot;), context.getVertexBufferObjectManager()){
              @Override
              public boolean onAreaTouched(final TouchEvent pSceneTouchEvent,
                                           final float pTouchAreaLocalX,
                                           final float pTouchAreaLocalY) {
                  this.setPosition(pSceneTouchEvent.getX() - this.getWidth() / 2, pSceneTouchEvent.getY() - this.getHeight() / 2);
                  System.out.println(String.format(&quot;spriteB %fx%f&quot;, pSceneTouchEvent.getX(), pSceneTouchEvent.getY()));
                  return true;
              }
          };
  
  scene.attachChild(aSprite);
  scene.registerTouchArea(aSprite);
  sprite.put(&quot;spriteB&quot;,aSprite);
  </code></pre>
  <p>What am i not doing right here and why my sprite doesn't respond to the touch event ?</p>
  <p>Thanks.</p>
  <h1>In the log i get this</h1>
  <pre><code>06-10 15:11:51.598: V/AndEngine(1171): org.andengine.input.touch.TouchEvent$TouchEventPool&lt;TouchEvent&gt; was exhausted, with 0 item not yet recycled. Allocated 1 more.
  06-10 15:11:51.598: V/AndEngine(1171): org.andengine.util.adt.pool.PoolUpdateHandler$1&lt;TouchEventRunnablePoolItem&gt; was exhausted, with 0 item not yet recycled. Allocated 1 more.
  </code></pre>
  <p>and then a bunch of lines like this one</p>
  <pre><code>06-10 15:11:51.628: W/Trace(1171): Unexpected value from nativeGetEnabledTags: 0
  06-10 15:11:51.688: W/Trace(1171): Unexpected value from nativeGetEnabledTags: 0
  06-10 15:11:51.708: W/Trace(1171): Unexpected value from nativeGetEnabledTags: 0
  </code></pre>