Search code examples
androidlibgdx

libGDX android onPause listener


In my libGDX game I want to display pause dialog when onPause() occur in android AndroidApplication class

Can some one tell me how to implement callback from Android to libGDX code not reverse?

Should I first need to make request from libGDX Game Screen to the Android class, and then fire callback from Android to libGDX when onPause() occur ? OR there is simple way ?

Thanks


Solution

  • pause() and resume() is the life cycle method of ApplicationListener interface.

    On Android pause() method is called when the Home button is pressed or an incoming call is received.

    onPause() --> pause()
    

    Override this method and show your dialog. No need of any callback or anything else.