Giriş
Şu satırı dahil ederiz.
Şöyle yaparız
Şu satırı dahil ederiz.
import com.google.android.gms.maps.OnMapReadyCallback;
GoogleMap ile gelen SupportMapFragment kullanarak şöyle yaparız.@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_maps);
// Obtain the SupportMapFragment and get notified
when the map is ready to be used.
SupportMapFragment mapFragment = (SupportMapFragment)getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
new GetAddress().execute();
}
onMapReady metoduŞöyle yaparız
public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
public GoogleMap mMap;
...
@Override
public void onMapReady(GoogleMap googleMap) {
mMap = googleMap;
mMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
if (ContextCompat.checkSelfPermission(this,
Manifest.permission.ACCESS_FINE_LOCATION)
== PackageManager.PERMISSION_GRANTED) {
mMap.setMyLocationEnabled(true);
}
mMap.getUiSettings().setCompassEnabled(true);
mMap.getUiSettings().setZoomControlsEnabled(true);
mMap.getUiSettings().setMyLocationButtonEnabled(true);
...
}
...
}
Hiç yorum yok:
Yorum Gönder