Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. MapActivity:
  2.  
  3. public void onCreate(Bundle savedInstanceState) {
  4.       super.onCreate(savedInstanceState);
  5.       setContentView(R.layout.weather_map_layout);
  6.  
  7.       mapView = (MapView) findViewById(R.id.myMapView);
  8.      
  9.       Bundle extras = getIntent().getExtras();
  10.      
  11.       float lat = extras.getFloat("latitude");
  12.       float longi = extras.getFloat("longitude");
  13. ....
  14.  
  15.  
  16. ListActivity:
  17.  
  18. ....
  19.  
  20. protected void onListItemClick(ListView l, View v, final int position, long id) {
  21.  
  22.         super.onListItemClick(l, v, position, id);
  23.         Intent newIntent = new Intent(ListarLocaisActivity.this, MapaActivity.class);
  24.        
  25.         Place coordenadas=listAdapter.getItem(position);
  26.         double lat = coordenadas.getLatitude();
  27.         double longi = coordenadas.getLongitude();
  28.        
  29.         newIntent.putExtra("latitude", lat);
  30.         newIntent.putExtra("longitude",longi);
  31.  
  32.         startActivity(newIntent);
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement