I\'m trying to do a game with andengine library
.
When the Sprite Enemy1Sprite
reach the top of the camera, and I detach it, this exception
You've answered your own question really - Marcelo is correct, the issue is not in the code you posted, it's where you are doing the detachChild call - you need to call that on the Update Thread, as in
runOnUpdateThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
yourScene.detachChild(yourEnemySprite);
}
});