I have the following code:
Sprite sPlayer = new Sprite(800 / 2, 480 / 2,
playerTextureRegion,
engine.getVertexBufferObjectManager()){
@Override
public boolean onAreaTouched(final TouchEvent tEvent, final float X,
final float Y)
{
if ( tEvent.isActionDown() )
// Some code
return true;
};
};
gameScene.registerTouchArea(sPlayer);
gameScene.setTouchAreaBindingOnActionDownEnabled(true);
gameScene.attachChild(sPlayer);
gameScene.setTouchBindingEnabled(True)
instead of gameScene.setTouchAreaBindingOnActionDownEnabled(true);
but Eclipse doesn't recognize this one and I can't import any package for it. What exactly am I doing wrong?Thanks in advance for your answers.
According to your comment, you need to use the function runOnUiThread
YourActivity.runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(YourActivity.this, msg, Toast.LENGTH_SHORT).show();
}
});
or, you can use the function toastOnUiThread
:
YourActivity.toastOnUiThread(msg,Toast.LENGTH_SHORT);
where YourActivity
is your activity in the game(just pass a reference to it)