Android: 如何在Service里使用Context
参考文档: 在Service中获得Context
使用方法: Service 本身就是 Context 的实现,所以只需要调用 this,示例代码如下:
1 | /** |
1. 在AsyncTask中使用context
传入Context,在doInBackground(Context... params){}中调用就好啦。
Android 多线程之IntentService 完全详解
参考文档: https://blog.csdn.net/javazejian/article/details/52426425