구글맵 처음이라 이러저리 소스찾아봐서 만든건데

컴퓨터로 돌리면 이렇게떠요.. 원래는 구글맵이뜨고 내현재위치가 표시 되어야합니다.
소스
-------------------------------------------------------------------------------------------------------------
GooglePlayServicesUtil.isGooglePlayServicesAvailable(Map.this);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, true);
if(provider==null){ //위치정보 설정이 안되어 있으면 설정하는 엑티비티로 이동합니다
new AlertDialog.Builder(Map.this)
.setTitle("위치서비스 동의")
.setNeutralButton("이동" ,new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
startActivityForResult(new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS), 0);
}
}).setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialog) {
finish();
}
})
.show();
}else{ //위치 정보 설정이 되어 있으면 현재위치를 받아옵니다
locationManager.requestLocationUpdates(provider, 1, 1, Map.this);
setUpMapIfNeeded();
}
}
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {//위치설정 엑티비티 종료 후
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case 0:
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Criteria criteria = new Criteria();
provider = locationManager.getBestProvider(criteria, true);
if(provider==null){//사용자가 위치설정동의 안했을때 종료
finish();
}else{//사용자가 위치설정 동의 했을때
locationManager.requestLocationUpdates(provider, 1L, 2F, Map.this);
setUpMapIfNeeded();
}
break;
}
}
@Override
public void onBackPressed() {
this.finish();
}
@Override
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
}
@Override
protected void onPause() {
super.onPause();
locationManager.removeUpdates(this);
}
private void setUpMapIfNeeded() {
if (mmap == null) {
mmap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map2)).getMap();
if (mmap != null) {
setUpMap();
}
}
}
private void setUpMap() {
mmap.setMyLocationEnabled(true);
mmap.getMyLocation();
}
boolean locationTag=true;
@Override
public void onLocationChanged(Location location) {
if(locationTag){//한번만 위치를 가져오기 위해서 tag를 주었습니다
Log.d("myLog" , "onLocationChanged: !!" + "onLocationChanged!!");
double lat = location.getLatitude();
double lng = location.getLongitude();
Toast.makeText(Map.this, "위도 : " + lat + " 경도: " + lng , Toast.LENGTH_SHORT).show();
locationTag=false;
}
}