Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {
  2. private static final int PERMISSION_ACCESS_COARSE_LOCATION = 0; private GoogleMap mMap;
  3.  
  4. @Override
  5. protected void onCreate(Bundle savedInstanceState) {
  6. super.onCreate(savedInstanceState);
  7. setContentView(R.layout.activity_maps);
  8. final Intent QuestionarioSegurancaActivity = new Intent(this, ActiveQuestionarioSeguranca2Activity.class);
  9. Button button_Localizacao = (Button) findViewById(R.id.button_questionario_enviar_localizacao);
  10. Button button_voltar_mapas = (Button) findViewById(R.id.button_maps_voltar);
  11. // Obtain the SupportMapFragment and get notified when the map is ready to be used.
  12. SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
  13. mapFragment.getMapAsync(this);
  14. button_EnviarLocalizacao.setOnClickListener(new View.OnClickListener()
  15. {
  16. @Override
  17. public void onClick(View view) {
  18. startActivity(QuestionarioSegurancaActivity);
  19. }
  20. });
  21. }
  22. /** * Manipulates the map once available. * This callback is triggered when the map is ready to be used.
  23. * This is where we can add markers or lines, add listeners or move the camera. In this case,
  24. * we just add a marker near Sydney, Australia.
  25. * If Google Play services is not installed on the device, the user will be prompted to install
  26. * it inside the SupportMapFragment. This method will only be triggered once the user has
  27. * installed Google Play services and returned to the app.
  28. */
  29. @Override
  30. public void onMapReady(GoogleMap googleMap) {
  31. mMap = googleMap;
  32. if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
  33. mMap.setMyLocationEnabled(true);
  34. } else { }
  35. }
  36. }
  37.  
  38. }
Add Comment
Please, Sign In to add comment