2017-03-28 106 views
1

大家好我會做一個應用程序,告訴我在至極的經度和緯度的我。Android應用程序的位置

我嚴格遵循這一個(https://developer.android.com/guide/topics/location/strategies.html#BestPerformance),但最後一行

locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, locationListener); 

是紅色下劃線。

我使用 「導入android.location *。」當我進行調試時,我會進入該調用。 的問題是,在LocationManager.java有這些錯誤的「進口」:

import com.android.internal.location.ProviderProperties; 
import android.annotation.RequiresPermission; 
import android.annotation.SystemApi; 
import android.annotation.TestApi; 

有人能幫助我嗎?

回答

0

嘗試添加那些

import android.location.Location; import android.location.LocationManager;

+0

,我已經盡力了,我進口android.location *; – Andrea

0

嘗試使用這種進口:

import android.location.Location; 
import android.location.LocationManager; 
+0

我已經試過了,我導入了android.location。*; – Andrea

+0

你需要使用那些導入,你不能使用這樣的一般導入。 – VidalRmrz

+0

其實我只導入這兩個(也添加LocationListener),但問題仍然存在:LocationManager.java中的 我仍然有這4個錯誤導入:( – Andrea