Java 位置客户端android
我下载了samlpe地理围栏代码。我对以下代码有疑问Java 位置客户端android,java,android,geolocation,Java,Android,Geolocation,我下载了samlpe地理围栏代码。我对以下代码有疑问 private void requestConnection() { getLocationClient().connect(); } /** * Get the current location client, or create a new one if necessary. * * @return A LocationClient object */ p
private void requestConnection() {
getLocationClient().connect();
}
/**
* Get the current location client, or create a new one if necessary.
*
* @return A LocationClient object
*/
private GooglePlayServicesClient getLocationClient() {
if (mLocationClient == null) {
mLocationClient = new LocationClient(this, this, this);
}
return mLocationClient;
}
我听不懂这句话
getLocationClient().connect();
getLocationClient是类中的一个方法,但我不知道如何实现。它是压倒一切的吗?我知道这与OOP概念有关。但是错过了。请在这方面帮助我getLocationClient是类中的一个方法,但我不知道如何使用 您的类定义方法“getLocationClient”,该方法基本上创建LocationClient的新实例,并将其分配给类变量mlLocationClient(如果以前未分配)。有关其用途,请参阅 方法是在类LocationClient中定义的,由于getLocationClient()返回LocationClient的实例,因此语句getLocationClient().connect()是有意义的 对于信息-LocationClient用于Google定位服务,connect()方法连接到Google Play服务
getLocationClient()
返回类型为GooglePlayServiceClient
的对象,类GooglePlayServiceClient
定义方法connect()
这确实是纯/basic/OOP/java语法;-)