0
현재 앱에서 현재 위치를 검색하고 있지만이 위치의 텍스트 나 최소한 도시와 같은 텍스트가 필요합니다.Google지도 API v2를 사용하여 TEXT로 현재 위치 가져 오기
내가 할 수있는 알려진 방법이 있습니까?
이 내가 지금까지 무엇을 가지고 :
package ro.gebs.captoom.activities;
import android.app.Activity;
import android.location.Criteria;
import android.location.Location;
import android.location.LocationManager;
import android.os.Bundle;
import android.view.Window;
import com.example.captoom.R;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class LocationActivity extends Activity {
private GoogleMap map;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getActionBar().hide();
setContentView(R.layout.preview_location);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
String provider = service.getBestProvider(criteria, false);
Location location = service.getLastKnownLocation(provider);
LatLng userLocation = new LatLng(location.getLatitude(),location.getLongitude());
if (map != null) {
Marker current_location_marker = map.addMarker(new MarkerOptions().position(userLocation)
.title("Current Location"));
} else {
}
map.moveCamera(
CameraUpdateFactory.newLatLngZoom(userLocation, 10));
// Zoom in, animating the camera.
map.animateCamera(
CameraUpdateFactory.zoomTo(10), 2000, null);
}
}
에서
address
를 얻을 수 및 사용이 질문에 대한 내 대답을 참조하십시오) 방법? – iaindownie네, 그게 정확히 제가 찾고있는 것입니다, 정말 고마워요! –
좋은 물건 - 그것이 당신이 찾고있는 대답이라면, 플러스? – iaindownie