[英]Android Studio Location API implementing class signature
大家如何更改类签名以实现googleapiclient? 如果单击图像,它将显示该教程,但没有清楚显示该怎么做。 我不明白它说何时实施,因为我不知道怎么做? 有人可以帮忙吗?
这是我的代码:
public class MainActivity extends ActionBarActivity {
//private LocationManager locationManager;
private Location currentLocation;
private TextView locationText;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//locationManager = (LocationManager) this.getSystemService(Context.LOCATION_SERVICE);
locationText = (TextView) findViewById(R.id.textView1);
}
private void updateDisplay(){
if (currentLocation==null){
locationText.setText("determining your location...");
} else {
locationText.setText(
String.format("Your location:\n%2f, %.2f", currentLocation.getLatitude(),
currentLocation.getLongitude()));
}
}
private LocationListener mListener = new LocationListener(){
@Override
public void onLocationChanged(Location location){
currentLocation=location;
updateDisplay();
}
@Override
public void onProviderDisabled(String provider){
}
@Override
public void onProviderEnabled(String provider){
}
@Override
public void onStatusChanged(String provider, int status, Bundle extras){
}
};
@Override
public void onResume(){
super.onResume();
//currentLocation = locationManager.getLastKnownLocation(locationManager.GPS_PROVIDER);
updateDisplay();
//locationManager.requestLocationUpdates(locationManager.GPS_PROVIDER, 0, 0, mListener);
}
@Override
public void onPause(){
super.onPause();
//locationManager.removeUpdates(mListener);
}
如何更改类签名以实现googleapiclient?
Add将implements GoogleApiClient.ConnectionCallbacks
到您的类,并实现它所需的方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.