HarmonyOS context子线程获取?

无法在子线程中获取 context(通过getContext(this))

子线程获取资源 url 后,需要获取 ApplicationContext 然后存储在 cacheDir 下

阅读 561
1 个回答

子线程获取不到,getContext依赖默认UI上下文,子线程很难跟踪到正确的上下文

没有其它方式在子线程获取 ApplicationContext,要么就创建线程的时候传过去