toast is displayed before getting GPS location
<p>When I press the button to start getting the location , immediately the toast message comes up and shows  lat:0  lon:0  (the initialized values).</p>

<p>After a few seconds I must press again the button to get location and then it shows the location.</p>

<p>What can I do for that?</p>

<p>(As I understand , if I use delay it doesn't solve the problem.I want the toast message to wait until I get the location)</p>

<pre><code> if(gps.canGetLocation()){

 latitude = gps.getLatitude();
 longitude = gps.getLongitude();

    Toast.makeText(getApplicationContext(), "Your Location is  \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
                    ...
</code></pre>

<p>I used sth like:</p>

<pre><code> private void showToast() {
               new Thread() {
                   public void run() {
                    try {   
                       while (message) {
                           runOnUiThread(new Runnable() {
                                @Override
                                public void run() {

                           if(gps.canGetLocation()){

                                latitude = gps.getLatitude();
                    longitude = gps.getLongitude();

        Toast.makeText(getApplicationContext(), "Your Location is \nLat: " + latitude + "\nLong: " + longitude, Toast.LENGTH_LONG).show();
                                 message=false;
                                  }else{

                                    gps.showSettingsAlert();
                                }
                           });
                           Thread.sleep(1000);
                       } 
                   }   catch (InterruptedException e) {
                        e.printStackTrace();
                   }
                   }
               }.start();
               }        
</code></pre>

<p>But it doesn't seem to work.Also ,is there a way to show another message until the location is found?</p>
