error message for wi -fi turned off
<p>I create application using map.</p>

<p>It works, but when there's no internet or wifi the application crashes.</p>

<p>Instead of crashing I want to show error message in device.</p>

<p>It is not shown in logcat. </p>

<p>Here's my code:</p>

<pre><code>LocationManager myManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE);
if(myManager != null){
    String param=(String)myManager.getProviders(true).get(0);
    Location loc = myManager.getLastKnownLocation(param);

    if(loc != null){
         ............
    } else {
         Log.e("AndroidMaps-1 ","Error: Location  is null");
         builder.setMessage("err").setPositiveButton("Yes",dialogClickListener).show();
    }   
} else {
    Log.e("AndroidMaps-2 ","Error: Location Manager is null");
    builder.setMessage("Are you sure").setPositiveButton("Yes",dialogClickListener).show();
}
</code></pre>

<p>when wi-fi is turned off I do not get any error message from logcat or dialog box.</p>
