Android examples for Activity:Activity Feature
find Activity From Context
//package com.java2s; import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; public class Main { public static Activity findActivityFromContext(Context ctx) { if (ctx != null) { if (ctx instanceof Activity) { return (Activity) ctx; }// ww w.j a v a2 s.c om if (ctx instanceof ContextWrapper) { ContextWrapper cw = (ContextWrapper) ctx; return findActivityFromContext(cw.getBaseContext()); } } return null; } }