我已經生成Current location
價值,我將它傳遞給URL的動態。我在Logcat中獲得了Latitude
和'經度'的價值。但當前不生成LatLongUrl
的動態UR1。動態URL目前不會產生拉特和長android
Log.d(String.valueOf(mLastLocation.getLatitude()),"Latitude");
Log.d(String.valueOf(mLastLocation.getLongitude()),"Longitude");
//urlJsonObj = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=21.2150756,72.8880545&radius=500&type=hospital&key=AIzaSyBldIefF25dfjjtMZq1hjUxrj4T4hK66Mg";
urlJsonObj = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+String.valueOf(mLastLocation.getLatitude()+","+String.valueOf(mLastLocation.getLongitude()+"&radius=500&type=hospital&key=AIzaSyBldIefF25dfjjtMZq1hjUxrj4T4hK66Mg";
Log.d(urlJsonObj,"LatLongUrl");
logcat的顯示如波紋管,其中當前沒有生成緯度的值和「經度」產生的,但是動態URL爲LatLongUrl
。
04-20 15:00:45.477 3209-3209/com.example.chaitanya.nearbyplace D/21.225225225225223: Latitude
04-20 15:00:45.477 3209-3209/com.example.chaitanya.nearbyplace D/72.8905100797212: Longitude
[ 04-20 15:00:45.477 3209: 3209 D/https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=21.225225225225223&radLatLongUrl
更新quetion
我有更新代碼波紋管。但它仍然沒有正確生成URL。
String Latitude = String.valueOf(mLastLocation.getLatitude());
String Longitude = String.valueOf(mLastLocation.getLongitude());
urlJsonObj = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location="+Latitude+","+Longitude+"&radius=500&type="+TypeName+"&key=AIzaSyBldIefF25dfjjtMZq1hjUxrj4T4hK66Mg";
Log.d(urlJsonObj,"LatLongUrl");
在logcat的
[ 04-20 15:24:57.826 23415:23415 D/https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=21.225225225225223,72.LatLongUrl
聲明String.valueOf(mLastLocation.getLatitude())和String.valueOf(mLastLocation.getLongitude()並使用String格式生成URL。 – Sajithv
首先在您的lJsonObject中設置硬編碼的位置值並檢查它是否到來的天氣! – Radhey
我已經做了同樣的事情,但它仍然生成經紀人的URL @Sajithv –