public static AppCompatActivity getAppCompActivity ( Context context ) { if ( context == null ) return null ; if ( context instanceof AppCompatActivity ) { return ( AppCompatActivity ) context ; } else if ( context instanceof ContextThemeWrapper ) { return getAppCompActivity ( ( ( ContextThemeWrapper ) context ) . getBaseContext ( ) ) ; } return null ; }
Get AppCompatActivity from context