Skip to main content
Yay for formatted code!
Source Link

To get the count of your game launch first make a LocalPreferences class and write following

public class LocalPreferencees{ Preferences prefs;

public class LocalPreferencees{
    Preferences prefs;

    public LocalPreferencees() {
        prefs = Gdx.app.getPreferences("GAMECOUNT");         
        }

     public void setCount (int count) {
        prefs.putInteger("COUNT",count);
        prefs.flush();
    }

    public int getCount() {
        return prefs.getInteger("COUNT",0);
    }
}

then in your create() method write following

@Override public void create() {

@Override
public void create(){

    LocalPreferences preferences=new LocalPreferences();

   //this will get your game launch count
    int count=preferences.getCount();

    //now set the count
    prferences.setCount(count+1);

}  

So each time when your game launches you will get the launchCount .

To get the count of your game launch first make a LocalPreferences class and write following

public class LocalPreferencees{ Preferences prefs;

public LocalPreferencees() {
    prefs = Gdx.app.getPreferences("GAMECOUNT");         
    }

 public void setCount (int count) {
    prefs.putInteger("COUNT",count);
    prefs.flush();
}

public int getCount() {
    return prefs.getInteger("COUNT",0);
}
}

then in your create() method write following

@Override public void create() {

    LocalPreferences preferences=new LocalPreferences();

   //this will get your game launch count
    int count=preferences.getCount();

    //now set the count
    prferences.setCount(count+1);

}  

So each time when your game launches you will get the launchCount .

To get the count of your game launch first make a LocalPreferences class and write following

public class LocalPreferencees{
    Preferences prefs;

    public LocalPreferencees() {
        prefs = Gdx.app.getPreferences("GAMECOUNT");         
        }

     public void setCount (int count) {
        prefs.putInteger("COUNT",count);
        prefs.flush();
    }

    public int getCount() {
        return prefs.getInteger("COUNT",0);
    }
}

then in your create() method write following

@Override
public void create(){

    LocalPreferences preferences=new LocalPreferences();

   //this will get your game launch count
    int count=preferences.getCount();

    //now set the count
    prferences.setCount(count+1);

}  

So each time when your game launches you will get the launchCount .

Source Link

To get the count of your game launch first make a LocalPreferences class and write following

public class LocalPreferencees{ Preferences prefs;

public LocalPreferencees() {
    prefs = Gdx.app.getPreferences("GAMECOUNT");         
    }

 public void setCount (int count) {
    prefs.putInteger("COUNT",count);
    prefs.flush();
}

public int getCount() {
    return prefs.getInteger("COUNT",0);
}
}

then in your create() method write following

@Override public void create() {

    LocalPreferences preferences=new LocalPreferences();

   //this will get your game launch count
    int count=preferences.getCount();

    //now set the count
    prferences.setCount(count+1);

}  

So each time when your game launches you will get the launchCount .