Android根据上下文对象Context找到对应的Activity
16lz
2021-12-04
Android根据上下文对象Context找到对应的Activity:
@Nullable public static Activity findActivity(Context context) { if (context instanceof Activity) { return (Activity) context; } if (context instanceof ContextWrapper) { ContextWrapper wrapper = (ContextWrapper) context; return findActivity(wrapper.getBaseContext()); } else { return null; } }
更多相关文章
- Android(安卓)7.1 根据4G共享动态调整以太网优先级
- Android中按钮点击效果显示
- Android(安卓)的manager
- android 菜单实例
- android菜单详解
- Increase the android VM heap size.
- Android中的Junit单元测试
- 完美解决android Studio打开报错 https://code.google.com/p/and
- ContentProvider(一)