这两行等价吗? 它们在我的应用程序中的行为有所不同。
locationManager = (LocationManager) context.getSystemService(LOCATION_SERVICE);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
谢谢
最佳答案
是的,它们是相同的,第一个来自 Activity
或 Service
以外的任何内容,而另一个则来自这两个中的一个。
关于android - LocationManager 和 LOCATION_SERVICE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17708679/