mLocationClient cannot be resolved

感情迁移 提交于 2019-12-13 04:35:22

问题


I have a problem using the Google Play location services. I was trying to follow http://developer.android.com/training/location/retrieve-current.html more or less. However Eclipse tells me that it cannot resolve my LocationClient. My code looks like this:

    @Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    overridePendingTransition(0,0);

    mLocationClient = new LocationClient(this, this, this); 


    if (savedInstanceState == null) {
        getSupportFragmentManager().beginTransaction()
                .add(R.id.container, new PlaceholderFragment()).commit();
    }
}

@Override
protected void onStart() {
    super.onStart();
    // Connect the client.
    mLocationClient.connect();
}

I got a feeling, that the google-play-services library is not referenced proper, but when I got to the properties of my project there is a green check mark next to it. If you need more code let me know. Thanks in advance!


回答1:


Close and reopen your project.

Clean and rebuild your project.

Make sure you've added the correct imports to your activity class.

Make sure you have private LocationClient mLocationClient; defined in your activity.



来源:https://stackoverflow.com/questions/24004471/mlocationclient-cannot-be-resolved

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!