java - Why the getApplication() from Service Class on android can still return its sub class obj? -
as title, i've seen code below in custom service class of kiahapplication acquire app's application obj: ((kiahapplication)super.getapplication()).setservicerunning(true); but how android.app.service class's getapplication method know & return custom application obj? android.app.service should not part of custom application, and it's not recorded in application's manifest file should definition of app's members. thank helping! super.getapplication() call getapplication in super class, android.app.service ((kiahapplication)super.getapplication()) cast result of super.getapplication() kiahapplication , class kiahapplication extends application ((kiahapplication)super.getapplication()).setservicerunning(true); call setservicerunning(true); on kiahapplication class but how service class's getapplication method know & return custom application obj? because it's singleton. anywhere call getapplication() retu...