title: Android AndEngine problem with touch events
body: <p>I'm learning andEngine and trying to make a simple game based on some examples. My problem is that the game stops in some random moments and I can only use back button ;/ I used logcat and found problem, here's log:</p>
  
  <blockquote>
    <p>/release-keys'</p>
    
    <p>I/DEBUG   ( 2656): pid: 4918, tid:
    4926  >>> com.homework.mygame &lt;&lt;&lt;
    I/DEBUG   ( 2656): signal 11
    (SIGSEGV), code 1 (SEGV_MAPERR), fault
    addr 3f8191d 4 I/DEBUG   ( 2656):  r0
    00000000  r1 00000000  r2 3f800000  r3
    000191d4 I/DEBUG   ( 2656):  r4
    00140a30  r5 00149978  r6 449d9b18  r7
    44dbe008 I/DEBUG   ( 2656):  r8
    449d9b6c  r9 43707d58  10 43707d40  fp
    449d9ed8</p>
    
    <p>I/DEBUG   ( 2656):  ip 00000000  sp
    449d9b00  lr 8062eeb8  pc 806189b8 
    cpsr 600 00010 I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 3 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    3 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 4 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    4 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 5 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    5 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 6 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    6 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 7 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    7 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 8 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    8 item not yet recycled. Allocated 1
    more . I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 9 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    9 item not yet recycled. Allocated 1
    more . D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 166K, 55% free
    2686K/5895K, ex ternal 905K/987K,
    paused 268ms I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 10 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    10 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 11 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    11 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 12 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    12 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 13 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    13 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 14 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    14 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 15 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    15 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 16 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    16 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 17 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    17 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 18 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    18 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 19 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    19 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 20 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    20 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 21 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    21 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 22 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    22 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 23 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    23 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 24 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    24 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 25 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    25 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 26 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    26 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 27 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    27 item not yet recycled. Allocated 1
    mor e. D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 10K, 55% free
    2686K/5895K, ext ernal 905K/927K,
    paused 294ms D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 5K, 55% free
    2686K/5895K, exte rnal 920K/1016K,
    paused 135ms I/DEBUG   ( 2656):       </p>
    
    <h1>00  pc 000189b8  /data/data/com.homework.mygame/lib</h1>
    
    <p>/libandenginephysicsbox2dextension.so
    (_ZN6b2Body13CreateFixtureEPK12b2FixtureDe
    f) I/DEBUG   ( 2656):          #01  pc
    0000bfbc 
    /data/data/com.homework.mygame/lib
    /libandenginephysicsbox2dextension.so
    (Java_com_badlogic_gdx_physics_box2d_Body_
    jniCreateFixture__JJFFFZSSS) I/DEBUG<br>
    ( 2656):          #02  pc 00011d74 
    /system/lib/libdvm.so I/DEBUG   (
    2656): I/DEBUG   ( 2656): code around
    pc: I/DEBUG   ( 2656): 80618998
    eb00595d e3500000 0a000001 e1a00004
    I/DEBUG   ( 2656): 806189a8 ebfffd9f
    e594205c e3a03a19 e2833f75 I/DEBUG   (
    2656): 806189b8 e7921003 e1a00005
    e3811001 e7821003 I/DEBUG   ( 2656):
    806189c8 e8bd81f0 e594105c e1a00005
    e284200c I/DEBUG   ( 2656): 806189d8
    e2811a19 e2811f76 eb0003ae eaffffe2
    I/DEBUG   ( 2656): I/DEBUG   ( 2656):
    code around lr: I/DEBUG   ( 2656):
    8062ee98 e51d0004 e12fff1e e1a0c000
    e1a00001 I/DEBUG   ( 2656): 8062eea8
    e1a0100c eaffffff e92d400f ebffffe1
    I/DEBUG   ( 2656): 8062eeb8 e3500000
    43700000 e8bd800f e52de008 I/DEBUG   (
    2656): 8062eec8 ebfffff8 03a00001
    13a00000 e49df008 I/DEBUG   ( 2656):
    8062eed8 e52de008 ebfffff3 33a00001
    23a00000 I/DEBUG   ( 2656): I/DEBUG<br>
    ( 2656): stack: I/DEBUG   ( 2656):<br>
    449d9ac0  43707d58 I/DEBUG   ( 2656): 
    449d9ac4  43707d40 I/DEBUG   ( 2656): 
    449d9ac8  449d9ed8 I/DEBUG   ( 2656): 
    449d9acc  80617174 
    /data/data/com.homework.mygame/lib/li
    bandenginephysicsbox2dextension.so
    I/DEBUG   ( 2656):     449d9ad0 
    00149978 I/DEBUG   ( 2656):<br>
    449d9ad4  449d9b18 I/DEBUG   ( 2656): 
    449d9ad8  0000ffff I/DEBUG   ( 2656): 
    449d9adc  44dbe008 I/DEBUG   ( 2656): 
    449d9ae0  00000001 I/DEBUG   ( 2656): 
    449d9ae4  00000000 I/DEBUG   ( 2656): 
    449d9ae8  00000000 I/DEBUG   ( 2656): 
    449d9aec  421cf249 I/DEBUG   ( 2656): 
    449d9af0  bf800001 I/DEBUG   ( 2656): 
    449d9af4  8062ef1c 
    /data/data/com.homework.mygame/lib/li
    bandenginephysicsbox2dextension.so
    I/DEBUG   ( 2656):     449d9af8 
    df002777 I/DEBUG   ( 2656):<br>
    449d9afc  e3a070ad I/DEBUG   ( 2656):</p>
    
    <h1>00 449d9b00  ffffffff I/DEBUG   ( 2656):     449d9b04  00000000 I/DEBUG</h1>
    
    <p>( 2656):     449d9b08  80632718
    I/DEBUG   ( 2656):     449d9b0c 
    43707d84 I/DEBUG   ( 2656):<br>
    449d9b10  449d9b6c I/DEBUG   ( 2656): 
    449d9b14  8060bfc0 
    /data/data/com.homework.mygame/lib/li
    bandenginephysicsbox2dextension.so
    I/DEBUG   ( 2656): #01 449d9b18 
    80632718 I/DEBUG   ( 2656):<br>
    449d9b1c  0016a928 I/DEBUG   ( 2656): 
    449d9b20  00000000 I/DEBUG   ( 2656): 
    449d9b24  00000000 I/DEBUG   ( 2656): 
    449d9b28  00000000 I/DEBUG   ( 2656): 
    449d9b2c  00000000 I/DEBUG   ( 2656): 
    449d9b30  00017b00 I/DEBUG   ( 2656): 
    449d9b34  0000ffff I/DEBUG   ( 2656): 
    449d9b38  449d9b90 I/DEBUG   ( 2656): 
    449d9b3c  00000003 I/DEBUG   ( 2656): 
    449d9b40  44843052 I/DEBUG   ( 2656): 
    449d9b44  aca11d78 
    /system/lib/libdvm.so I/AndEngine(
    4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 28 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    28 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 29 item
    not yet recycled. Allocated 1 more.
    D/dalvikvm(  602): Cronos
    GC_EXTERNAL_ALLOC freed 257K, 40% free
    6266K/10311K, e xternal 1546K/1581K,
    paused 445ms I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    29 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 30 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    30 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 31 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    31 item not yet recycled. Allocated 1
    mor e. I/AndEngine( 4918):
    org.anddev.andengine.input.touch.TouchEvent$TouchEventPool was exhausted, with 32 item
    not yet recycled. Allocated 1 more.
    I/AndEngine( 4918):
    org.anddev.andengine.util.pool.PoolUpdateHandler$1 was exhausted, with
    32 item not yet recycled. Allocated 1
    mor e. D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 11K, 55% free
    2685K/5895K, ext ernal 726K/889K,
    paused 139ms D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 10K, 55% free
    2686K/5895K, ext ernal 667K/749K,
    paused 140ms D/dalvikvm(  929): Cronos
    GC_EXTERNAL_ALLOC freed 5K, 55% free
    2685K/5895K, exte rnal 920K/1016K,
    paused 138ms D/dalvikvm(  602): Cronos
    GC_EXTERNAL_ALLOC freed 32K, 40% free
    6246K/10311K, ex ternal 1403K/1470K,
    paused 343ms I/BootReceiver(  602):
    Copying /data/tombstones/tombstone_02
    to DropBox (SYSTEM_ TOMBSTONE)
    E/InputDispatcher(  602): channel
    '408f3600
    com.homework.mygame/com.homework.myg
    ame.com.homework.mygame (server)' ~
    Consumer closed input channel or an
    error oc curred.  events=0x8
    E/InputDispatcher(  602): channel
    '408f3600
    com.homework.mygame/com.homework.myg
    ame.com.homework.mygame (server)' ~
    Channel is unrecoverably broken and
    will be disposed! D/Zygote  (  565):
    Process 4918 terminated by signal (11)
    D/dalvikvm(  602): Cronos
    GC_FOR_MALLOC freed 123K, 39% free
    6384K/10311K, exter nal 958K/1470K,
    paused 141ms I/dalvikvm-heap(  602):
    Grow heap (frag case) to 9.928MB for
    161568-byte allocat ion D/dalvikvm( 
    602): Cronos GC_FOR_MALLOC freed 3K,
    38% free 6538K/10503K, externa l
    958K/1470K, paused 147ms
    I/WindowManager(  602): WIN DEATH:
    Window{408f3600
    com.homework.mygame/com.homew
    ork.mygame.com.homework.mygame
    paused=false} D/dalvikvm(  602):
    Cronos GC_FOR_MALLOC freed 2K, 38%
    free 6537K/10503K, externa l
    847K/1359K, paused 143ms
    I/dalvikvm-heap(  602): Grow heap
    (frag case) to 9.891MB for 80792-byte
    allocati on D/dalvikvm(  602): Cronos
    GC_FOR_MALLOC freed &lt;1K, 38% free
    6615K/10631K, extern al 847K/1359K,
    paused 144ms D/dalvikvm(  602): Cronos
    GC_FOR_MALLOC freed 217K, 40% free
    6398K/10631K, exter nal 847K/1359K,
    paused 142ms I/WindowManager(  602):
    WIN DEATH: Window{4090fff8 SurfaceView
    paused=false} D/gralloc (  602):
    freeing GPU buffer at 0 D/gralloc ( 
    602): freeing GPU buffer at 307200
    I/ActivityManager(  602): Process
    com.homework.mygame (pid 4918) has
    died. W/InputManagerService(  602):
    Got RemoteException sending
    setActive(false) notif ication to pid
    4918 uid 10088 D/dalvikvm(  929):
    Cronos GC_EXPLICIT freed 9K, 55% free
    2683K/5895K, external 4 89K/889K,
    paused 68ms
    V/com.mobilityflow.animatedweather.services.UpdateService$ServiceThread(
    929): Timed alarm onReceive() started
    at time: 2011-05-13 17:07:25.491
    W/System.err(  929):
    java.net.UnknownHostException:
    www.yr.no W/System.err(  929):    at
    java.net.InetAddress.lookupHostByName(InetAddress.jav
    a:506) W/System.err(  929):    at
    java.net.InetAddress.getAllByNameImpl(InetAddress.jav
    a:294) W/System.err(  929):    at
    java.net.InetAddress.getAllByName(InetAddress.java:25
    6) W/System.err(  929):    at
    org.apache.http.impl.conn.DefaultClientConnectionOper
    ator.openConnection(DefaultClientConnectionOperator.java:136)
    W/System.err(  929):    at
    org.apache.http.impl.conn.AbstractPoolEntry.open(Abst
    ractPoolEntry.java:164) W/System.err( 
    929):    at
    org.apache.http.impl.conn.AbstractPooledConnAdapter.o
    pen(AbstractPooledConnAdapter.java:119)
    W/System.err(  929):    at
    org.apache.http.impl.client.DefaultRequestDirector.ex
    ecute(DefaultRequestDirector.java:348)
    W/System.err(  929):    at
    org.apache.http.impl.client.AbstractHttpClient.execut
    e(AbstractHttpClient.java:555)
    W/System.err(  929):    at
    org.apache.http.impl.client.AbstractHttpClient.execut
    e(AbstractHttpClient.java:487)
    W/System.err(  929):    at
    org.apache.http.impl.client.AbstractHttpClient.execut
    e(AbstractHttpClient.java:465)
    W/System.err(  929):    at
    com.mobilityflow.animatedweather.weather_providers.Yr
    Provider.loadWeatherWeek(YrProvider.java:440)
    W/System.err(  929):    at
    com.mobilityflow.animatedweather.weather_providers.Yr
    Provider.providerLoadWeather(YrProvider.java:135)
    W/System.err(  929):    at
    com.mobilityflow.animatedweather.weather_providers.We
    atherProvider.loadWeatherData(WeatherProvider.java:125)
    W/System.err(  929):    at
    com.mobilityflow.animatedweather.WebProvider$ThreadWe
    atherLoad.run(WebProvider.java:256)</p>
  </blockquote>
  
  <p>So I guess it's because on onAreaTouched function. I use it to control a player, there are 2 arrows and we can touch them to move player from left to right. Am I doing it correctly or should I do it in another way ? Here's my code:</p>
  
  <pre><code> mRArrow = new Sprite(125, CAMERA_HEIGHT - 55, mRArrowTextureRegion) {
                  @Override
                  protected void onManagedUpdate(float pSecondsElapsed) {
  
                      super.onManagedUpdate(pSecondsElapsed);
                  }
  
                  @Override
                  public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                          float pTouchAreaLocalX, float pTouchAreaLocalY) {
  
  
                      Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                          .findBodyByShape(mPlayer);
  
                      playerBody.setTransform(new Vector2((playerBody.getPosition().x + 0.15f) ,playerBody.getPosition().y), 0);
  
                      return true;
                  }
               };
  
              mLArrow = new Sprite(15, CAMERA_HEIGHT - 55, mLArrowTextureRegion) {
                  @Override
                  protected void onManagedUpdate(float pSecondsElapsed) {
  
                      super.onManagedUpdate(pSecondsElapsed);
                  }
  
                  @Override
                  public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                          float pTouchAreaLocalX, float pTouchAreaLocalY) {
  
                      Body playerBody = mPhysicsWorld.getPhysicsConnectorManager()
                      .findBodyByShape(mPlayer);
  
                      playerBody.setTransform(new Vector2((playerBody.getPosition().x - 0.15f) ,playerBody.getPosition().y), 0);
  
                      return true;
                  }
               };
  </code></pre>
  
  <p>Thanks in advance</p>
  
  <p>Greg</p>