title: Passing location data to another activity in Android
body: <p>I'm working on an Android application development and i'm stuck in this point:</p>
  
  <p>I have 2 activities:
  First one called CurrentLoc and it gets me the current position and after getting the position i click on a button that take me to activity number 2 which called Sms.</p>
  
  <p>What i need to do is that i want to pass the position data that i have received in the first activity to the second activity when i click the button...</p>
  
  <p>Here is my code for the first activity :</p>
  
  <pre><code>    public class Tester2Activity extends Activity { 
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          startService(new Intent(Tester2Activity.this,SS.class));
  
          LocationManager mlocManager = (LocationManager)getSystemService       (Context.LOCATION_SERVICE);
          LocationListener mlocListener = new MyLocationListener();
          mlocManager.requestLocationUpdates( LocationManager.NETWORK_PROVIDER, 0, 0,     mlocListener);
  
  
          Button button1 = (Button) findViewById(R.id.widget30);
           button1.setOnClickListener(new View.OnClickListener() {
                public void onClick(View v) {
  
                    Intent hg = new Intent(Tester2Activity.this, Sms.class);
                    startActivity(hg);
  
  
  
          }
      });
  
  
  
          public class MyLocationListener implements LocationListener
      {
  
          @Override
          public void onLocationChanged(Location loc)
          {
              loc.getLatitude();
                         loc.getLongitude();
  
                    //This is what i want to pass to the other activity when i click on the button
  
  
          }
  
  
          @Override
          public void onProviderDisabled(String provider)
          {
  
          }
  
          @Override
          public void onProviderEnabled(String provider)
          {
  
          }
  
          @Override
          public void onStatusChanged(String provider, int status, Bundle extras)
          {
          }
  
  
      }
  
  }
  </code></pre>