Guest User

Untitled

a guest
Dec 14th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. if(mMap != null && location != null){
  2. LatLng gps = new LatLng(location.getLatitude(),
  3. location.getLongitude());
  4. marker = mMap.addMarker(new MarkerOptions().position(gps).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE)));
  5. marker.setDraggable(true);
  6.  
  7.  
  8. return marker;
  9. }
  10. return null;
  11. }
  12.  
  13.  
  14. public void drawMarker(View view) {
  15. if (marker == null) {
  16. Location loc = returnLocation();
  17. Double lat = loc.getLatitude();
  18. Double lon = loc.getLongitude();
  19. //para guardar un marker en sharedPreferences
  20. sharedPreferences.edit().putString("Lat",String.valueOf(lat)).apply();
  21. sharedPreferences.edit().putString("Lng",String.valueOf(lon)).apply();
  22. sharedPreferences.edit().putLong("time",System.currentTimeMillis()).apply();
  23. marker = addMarker(loc);
  24. dialogPlayas.dismiss();
  25. removeMarker.setVisibility(View.VISIBLE);
  26.  
  27. }
  28. }
  29.  
  30. customAdapter adapter = new customAdapter(this, imgid);
  31. list = (GridView) playasView.findViewById(R.id.list);
  32. list.setAdapter(adapter);
  33. list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
  34. @Override
  35. public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
  36. listaReporte.add(list.getSelectedItem());
  37. }
  38. });
  39. //Log.i("Mostrando lista",listaReporte.getFirst().toString());
  40. addMarker = playasView.findViewById(R.id.addMarker);
  41. dialogPlayas = mBuilder.create();
  42. dialogPlayas.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
  43. dialogPlayas.show();
  44. }
Add Comment
Please, Sign In to add comment