public static Activity scanForActivity ( Context context ) { if ( context == null ) return null ; if ( context instanceof Activity ) { return ( Activity ) context ; } else if ( context instanceof ContextWrapper ) { return scanForActivity ( ( ( ContextWrapper ) context ) . getBaseContext ( ) ) ; } return null ; }
Get activity from context object