public class Main extends ApplicationAdapter {

SpriteBatch batch;

OrthographicCamera camera;

Stage stage;

Image greyback;
Image circle;

private float width;
private float height;

public void create () {

    batch = new SpriteBatch();

    camera = new OrthographicCamera();

    stage = new Stage();

    greyback = new Image(new Texture("greyback.png"));
    circle = new Image(new Texture("circle.png"));

    width = Gdx.graphics.getWidth();
    height = Gdx.graphics.getHeight();



    circle.setBounds(200, 200, circle.getWidth(), circle.getHeight());
    circle.addListener(new InputListener() {

        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {


            return true;


        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {






public void render () {



} But, when I click on the circle the touchlistener doesnt fire, why?

  • \$\begingroup\$ Have you used a breakpoint to make sure it's not firing or are you just looking for the output in the console? If the output then are you on Desktop or android? System.out.println() only works on desktop. You can use Gdx.app.log() to make sure that it goes to the appropriate output regardless of platform \$\endgroup\$ Apr 1, 2016 at 15:50
  • \$\begingroup\$ im using System.out.println(); on the desktop. \$\endgroup\$ Apr 1, 2016 at 16:07

2 Answers 2


In your call

circle.setBounds(200, 200, circle.getWidth(), circle.getHeight());

The getWidth() and getHeight() calls are methods on Actor, not Image. You have not set the Actor's width and height, so you are setting its bounds to a rectangle with a height and width of 0... no clickable area.

Change the call to

circle.setBounds(200, 200, circle.getImageWidth(), circle.getImageHeight());
  • \$\begingroup\$ circle.getImageWidth() seems to be returning 0, any ideas why? \$\endgroup\$ Apr 1, 2016 at 17:58
  • \$\begingroup\$ According to the source, it looks like the internal width and height do not get set until layout() is called. Not sure why the libgdx devs did this, but perhaps you should call circle.layout() before circle.setBounds() \$\endgroup\$ Apr 1, 2016 at 18:07
  • \$\begingroup\$ the problem still persists... \$\endgroup\$ Apr 1, 2016 at 18:10
  • \$\begingroup\$ I just copied the code from your original post verbatim into a brand new Libgdx project (with my own circle and greyback images) and the event happens just fine. If you aren't using a debugger, I suggest using one and putting a breakpoint in the touchDown listener to make sure that it is not being called. It could be that the println is just being redirected somwhere \$\endgroup\$ Apr 1, 2016 at 19:26
  • \$\begingroup\$ i see, i appreciate it. \$\endgroup\$ Apr 1, 2016 at 20:12

You need to do this :


This will make your Stage acting, so your Button Listener will work :)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .