opc*_*0de 2 android android-context
我需要将一个上下文传递给一个函数,我无法得到它的上下文getApplicationContext()我必须说我的应用程序是一个服务.那么我怎样才能获得内部的上下文locationListener?
内部onLocationChanged(Location location)方法更准确
那么我如何在locationListener中获取上下文?
如果LocationListener是您服务的常规内部类,请使用MyServiceName.this.
如果LocationListener是静态内部类或单独的公共类,则在构造函数中提供Context.
换句话说,这与Java中的任何其他内容没有什么不同.
| 归档时间: |
|
| 查看次数: |
3475 次 |
| 最近记录: |