java - Libgdx Android: method onStart() not called after onCreate() -
onstart()
i know onstart() method called after oncreate() ( via activity lifecycle documentation ), in libgdx project doesn't happen. i' ve code:
@override protected void onstart() { super.onstart(); gdx.app.debug(tag, "onstart"); }
but string in debug terminal appears if resume app background. need stuff after initialise of activity, when becomes visible.
edit: more code
public class androidlauncher extends androidapplication { private final static string tag = androidlauncher.class.getsimplename(); googleresolver googleresolver; googlesigninaccount acct; private preferences googleprefs; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); googleresolver = new googleresolverandroid(); androidapplicationconfiguration config = new androidapplicationconfiguration(); config.useimmersivemode = true; config.usegyroscope = false; config.usecompass = false; config.useaccelerometer = false; googleloginhandler.getinstance().setcontext(this.getcontext()); googleloginhandler.getinstance().startapiclient(); gamemanager.getinstance().listener = googleresolver; initialize(new maincrucy(), config); googleprefs = gdx.app.getpreferences(google_pref); googleloginhandler.getinstance().mgoogleprefs = gdx.app.getpreferences(google_pref); } @override protected void onstart() { super.onstart(); gdx.app.debug(tag, "onstart"); optionalpendingresult<googlesigninresult> opr = auth.googlesigninapi.silentsignin(googleloginhandler.getinstance().getgoogleapiclient()); if (opr.isdone()) { gdx.app.debug(tag, "loggato"); googlesigninresult result = opr.get(); handlesigninresult(result); } else { opr.setresultcallback(new resultcallback<googlesigninresult>() { @override public void onresult(googlesigninresult googlesigninresult) { handlesigninresult(googlesigninresult); } }); } }
this do. onstart() anything
you can't use gdx.app.debug()
before libgdx application has had chance start up. i'm not positive if happens before onstart()
because libgdx doesn't run on ui thread. also, must use gdx.app.setloglevel(application.log_debug)
first or calls gdx.app.debug()
nothing.
but can use android's log.d()
instead.
Comments
Post a Comment