Example usage for android.content ContextWrapper getBaseContext

List of usage examples for android.content ContextWrapper getBaseContext

Introduction

In this page you can find the example usage for android.content ContextWrapper getBaseContext.

Prototype

public Context getBaseContext() 

Source Link

Usage

From source file:org.opensilk.video.util.Utils.java

public static Activity findActivity(Context context) {
    if (context instanceof Activity) {
        return (Activity) context;
    } else if (context instanceof ContextWrapper) {
        ContextWrapper contextWrapper = (ContextWrapper) context;
        return findActivity(contextWrapper.getBaseContext());
    } else {//from   w w  w .  j a va  2s .c  om
        throw new AssertionError("Unknown context type " + context.getClass().getName());
    }
}