code: def init_widget(self):
          
          #: Add a ActivityLifecycleListener to update the application state
          activity = self.widget
          activity.addActivityLifecycleListener(activity.getId())
          activity.onActivityLifecycleChanged.connect(
              self.on_activity_lifecycle_changed)
  
          #: Add BackPressedListener to trigger the event
          activity.addBackPressedListener(activity.getId())
          activity.onBackPressed.connect(self.on_back_pressed)
  
          #: Add ConfigurationChangedListener to trigger the event
          activity.addConfigurationChangedListener(activity.getId())
          activity.onConfigurationChanged.connect(self.on_configuration_changed)
docs: Initialize on the first call