@ Pure public static ClassLoader getContextClassLoader ( ) throws AndroidException { synchronized ( Android . class ) { final ClassLoader cl = ( contextClassLoader == null ) ? null : contextClassLoader . get ( ) ; if ( cl != null ) { return cl ; } } final Object context = getContext ( ) ; try { final Method method = context . getClass ( ) . getMethod ( "getClassLoader" ) ; //$NON-NLS-1$ final Object classLoader = method . invoke ( context ) ; final ClassLoader cl = ( ClassLoader ) classLoader ; synchronized ( Android . class ) { contextClassLoader = new WeakReference <> ( cl ) ; } return cl ; } catch ( Exception e ) { throw new AndroidException ( e ) ; } }
Replies the class loader of the current Android context .