Question

Successfully connecting while using this code:

Tutorial to add Google Play Services to LibGDX

However, I now have the android title bar visible. I have tried nailing down what exactly causes the title bar to show (and am using verbatim the code from the tutorial).

I think it is in having a MainActivity constructor in the mix, somehow, this bypasses the LibGDX calls that request noTitle.

So, I tried next to add in the Theme feature of NoTitleBar in my Manifest, and that works, but somehow, I now have orientation changes occurring (which is not what it says in the manifest)

Can anyone see what I need to do in either my Main project or Android project to

1) not have a title bar 2) not allow for orientation changes 3) have the hookup for Google Play Services

Here is the manifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="pgs.libgdx.liars.dice"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="17" />

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >

    <meta-data android:name="com.google.android.gms.games.APP_ID"
        android:value="@string/app_id" />

    <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
        android:screenOrientation="landscape"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

</manifest>

Here is relevant code from Android Project:

public class MainActivity extends AndroidApplication implements GameHelperListener, GoogleInterface {

private GameHelper aHelper;

private OnLeaderboardScoresLoadedListener theLeaderboardListener;

public MainActivity(){
    aHelper = new GameHelper(this);
    aHelper.enableDebugLog(true, "MYTAG");

    //create a listener for getting raw data back from leaderboard
    theLeaderboardListener = new OnLeaderboardScoresLoadedListener() {

        public void onLeaderboardScoresLoaded(int arg0, LeaderboardBuffer arg1,
                LeaderboardScoreBuffer arg2) {

            System.out.println("In call back");

            for(int i = 0; i < arg2.getCount(); i++){
                System.out.println(arg2.get(i).getScoreHolderDisplayName() + " : " + arg2.get(i).getDisplayScore());
            }
        }
    };
}

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
    cfg.useGL20 = false;
    aHelper.setup(this);
    initialize(new LiarsDiceGame(this), cfg);
}

and the Main relevant code:

public LiarsDiceGame(){

}

public LiarsDiceGame(GoogleInterface anInterface ) {
    platformInterface = anInterface;
    //platformInterface.Login();
}

@Override
public void create() {      
    float w = Gdx.graphics.getWidth();
    float h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera(1, h/w);
    batch = new SpriteBatch();

    texture = new Texture(Gdx.files.internal("data/libgdx.png"));
    texture.setFilter(TextureFilter.Linear, TextureFilter.Linear);

    TextureRegion region = new TextureRegion(texture, 0, 0, 512, 275);

    sprite = new Sprite(region);
    sprite.setSize(0.9f, 0.9f * sprite.getHeight() / sprite.getWidth());
    sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
    sprite.setPosition(-sprite.getWidth()/2, -sprite.getHeight()/2);
}

Everything else is exactly as it when setting up a LibGDX project using the gdx-setup-ui.jar

Was it helpful?

Solution

There is a problem with the syntax of your manifest file, in this line:

android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >

The angle bracket at the end of the line should not be there.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top