K
K
Kuusandr2019-05-28 15:09:25
Java
Kuusandr, 2019-05-28 15:09:25

How to set a reference to the class from which it is created in InputAdapter?

In the class method I create

InputProcessor backProcessor = new InputAdapter() {
            @Override
            public boolean keyDown(int keycode) {

                if ((keycode == Input.Keys.ESCAPE) || (keycode == Input.Keys.BACK)) {
//                    Gdx.app.exit();
                    game.setScreen(new ExitInGame(game,this_up_class));
                }
                return false;
            }

I’m very confused, it is required to pass a link to the class as the this_up_class parameter, but if I use this inside the inputadapter, then the system considers that this is a link to the adapter itself. How to get a reference to the class from which the inputadapter is created?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-05-28
@Kuusandr

OuterClass.this.
And not a reference to a class, but a reference to an instance of the class.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question