質問

Google Play Location Servicesを使用して問題があります。私は http://developer.android.com/training/location/retrieve-current.html 多かれ少なかれ。ただし、Eclipseは私のlocationClientを解決できないことを教えてくれます。私のコードはこのように見えます:

    @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();
}
.

私は、Google-Play-Servicesライブラリが適切に参照されていない感覚を得ましたが、プロジェクトのプロパティに着いたとき、その隣に緑色のチェックマークがあります。もっとコードが必要な場合は、お知らせください。事前にありがとう!

役に立ちましたか?

解決

プロジェクトを閉じて再開します。

プロジェクトをきれいにして再構築します。

アクティビティクラスに正しいインポートを追加してください。

Private LocationClient MLocationClientを必ず持っていることを確認してください。あなたの活動で定義されています。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top