you need to create a class that extends the libgdx game class.
public class MainClass extends Game
then in your method of creating the main class you must set the screen.
setScreen(new MainMenuScreen(this));
and in your mainmenuclass you need to implement the libgdx screen class.
public class MainMenuScreen implements Screen
and you must create such a constructor
public MainMenuScreen(Game game) { // TODO Auto-generated constructor stub this.game = game; camera = new OrthographicCamera(); camera.setToOrtho(false, scrw, scrh);//scrw is your screen width,scrh is screen height camera.update(); batch = new SpriteBatch(); Gdx.input.setInputProcessor(MainMenuScreen.this);}
I think this will work ...
source share