title: GPS locations are not retrieved properly
body: <p>Im new to android development and i understand the android activity life cycle. Please see the following code.</p>
  
  <pre><code>    public class MyTest extends Activity{
  
          @Override
          public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
  
          cont = getApplicationContext();
          final MyLocation my_loc = new MyLocation ();
          my_loc.initialize(cont);
  
          myMethod();
          }
  
      Public void myMethod()
      {
         //here when I retrieve the values, it always shows 0.0.
      }
  }
  
      public class MyLocation implements LocationListener {
          public double user_lat;
          public double user_lng;
          private LocationManager locationManager;
          private Context ctx;
  
          @Override
          public void onLocationChanged(Location location) {
              // TODO Auto-generated method stub
              user_lat = location.getLatitude();
              user_lng = location.getLongitude();     
  
              //here i save the values for constands to use in myMethod                           
              }
          }
  
          public void initialize(Context context) {
              this.ctx = context;
              locationManager = (LocationManager) context
                      .getSystemService(Context.LOCATION_SERVICE);
              locationManager.requestLocationUpdates(
                      LocationManager.NETWORK_PROVIDER, 0, 0, this);
              locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                      0, this);
          } 
  }
  </code></pre>
  
  <p>Why is it that i cannot initialize GPS and retrieve long and lat values in the same activity?</p>