LocationClient的回调参数未执行

时间:2014-05-28 16:49:15

标签: android google-maps

我在非活动类

中有此功能
public class MapClass extends Activity implements GooglePlayServicesClient.ConnectionCallbacks, GooglePlayServicesClient.OnConnectionFailedListener, OnItemSelectedListener { ...
protected boolean initiateMap(Context mainAppContext, MapFragment mapFrag) {
    ….
    mLocationClient = new LocationClient(mainAppContext, this, this);
    mLocationClient.connect();
    …
    }

我从mainactivity调用此函数,并将其上下文mainAppContext作为对象传递给func。

我的问题是LocationClient的最后两个arguemtns实际上是回调。

虽然我在同一个非活动类中定义了它们:

@Override
public void onConnected(Bundle arg0) {
    gotoCurrentLocation();
}

@Override
public void onDisconnected() {
    Toast.makeText(this, R.string.onDisconnected, Toast.LENGTH_LONG).show();
}

但他们永远不会被称为成功的联系?好像this在这种情况下不能正常工作(我实际上是从教程中看到的)。

有人可以帮助我将这两个回调作为LocationClient构造函数的参数传递吗?

0 个答案:

没有答案
相关问题