我有扩展AsyncTask
类的类,我创建此类AsyncTask
类的实例,使用来自方法的GPS驱动程序的数据
public void onLocationChanged(Location location) {}
来自界面LocationListener
的。
我想知道为什么应用程序在方法AsyncTask
中执行onLocationChanged()
实例?因为我想只在位置改变时在后台执行某些东西
答案 0 :(得分:0)
public void onLocationChanged(Location location) {
new yourAsyncTaksk(location).execute();
}
为您的asyncTask创建一个构造函数,并将Location对象作为参数。