Android IDE (AIDE) Support Forum

game.setScreen()

Trying to create a simple test app on my Samsung S9 using AIDE.
I have a main class that extends Game and another which implements Screen.
When the main class is created, it’s supposed to create a new Screen object and use setScreen to switch to the new screen.
The only rendering code picks a colour and clears the screen, each with a different clear colour, for me to know which part of the code is running.
The main class sets clear colour to white, while the screen class should set it to green.
When I run the code on my phone, it doesn’t appear to switch to the new screen.
Am I doing something wrong?

Main Class

public class MyGdxGame extends Game
{
@Override
public void create()
{
this.setScreen(new MainScreen(this));
}

@Override
public void render()
{        
    super.render();
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	
}

//…
}

Menu Screen Class

public class MainScreen implements Screen {
private Game game;
private Stage stage;

public MainScreen(Game game) {
	super();
	this.game = game;
	this.stage = new Stage();
}

@Override
public void show() {
	Gdx.input.setInputProcessor(stage);
}

@Override
public void render(float delta) {
	Gdx.gl.glClearColor(0, 1, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
	
	stage.act(delta);
	stage.draw();
}

//…
}

all java programs need a main method, from what i can see you dont have 1 which means your code doesnt do anything because its never ran.

Hi Suchuu,
Were you able to solve your issue?
I’m myself struggling with the badlogic gdx class and not able to sort it out.
Did you made anything special to be able to use this library? Downloading a JAR file for exemple. Or did it worked without specific declaration.?
I have been lazy, to make me life easier i did copy the source of the game course, but 90 syntax errors :wink: due to library pb