public static MortarScope getScope ( Context context ) { //noinspection ResourceType Object scope = context . getSystemService ( MORTAR_SERVICE ) ; if ( scope == null ) { // Essentially a workaround for the lifecycle interval where an Activity's // base context is not yet set to the Application, but the Application // context is available and contains a MortarScope that provides needed // services. Thanks, Android! //noinspection ResourceType scope = context . getApplicationContext ( ) . getSystemService ( MORTAR_SERVICE ) ; } return ( MortarScope ) scope ; }
Retrieves a MortarScope from the given context . If none is found retrieves a MortarScope from the application context .