I'm practicing making a game for android, using libgdx in Eclipse. In my first screen I add a TextButton and a Label to my stage. When I launch the desktop application the stage is displayed with the label and the button. However when I launch the Android application on my phone(Android 2.2) or emulator(Andorid 2.2 and 4.03), nothing is displayed only a blank screen. There are no errors that I can see in the logcat or console.
The logcat displays a copybit "Error opening frame buffer errno=13 (Permission denied)", however I don't think this is the cause.
I've checked my java build path and everything seems fine. After googling everywhere this is the only similar post I have found : libgdx game not working in android phones. On the most voted answer user 'nEx.Software' comments "By not working do you mean just showing a blank screen? That's because the Desktop starter creates a new instance of ScreenTest(), while the Android starter creates a new instance of ScreenGame()." I think this could solve my problem however I don't fully understand his/her comment.
Below is the code for my android starter class:
public class MainActivity extends AndroidApplication {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
cfg.useGL20 = true;
cfg.useAccelerometer = false;
cfg.useCompass = false;
initialize(new FirstGame(), cfg);
}
}
Edit
Below is the code for my games Main.java class:
public class FirstGame extends Game {
@Override
public void create() {
this.setScreen(new MainMenu(this));
}
@Override
public void dispose() {
}
@Override
public void resize(int width, int height) {
}
@Override
public void pause() {
}
@Override
public void resume() {
}
}
Any help would be greatly appreciated.
UPDATE
I figured out that it was displaying on my phone, however the stage was off-screen, thanks anyway