android - 如何获取当前上下文?

标签 android

我想在我的阵列适配器中使用它。当我将 this 放在子 Activity 中以创建适配器时,它不起作用。

最佳答案

getApplicationContext()可以获取上下文值

关于android - 如何获取当前上下文?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4721626/

相关文章:

android P 中的 android AppComponentFactory - 如何围绕外部 Activity 包装/装饰功能

android - GridView 中每个项目的不同高度

安卓改造 :onNext values needed in other class

android - 使用 Android 的 GLSurfaceView.RENDERMODE_CONTINUOUSLY 时如何限制帧率?

android - 改造 Android : how to fetch Json data using id and display into textview

android - Google Translate API 有时需要很长时间来初始化

java - Retrofit 2.0 + GSON 无法为接口(interface)调用无参数构造函数

android - 如何创建要在自定义布局上使用的自定义 LayoutParams?

android - 检测App android是否处于Debug或Release状态

android - Android 2.0 添加联系人号码