location is displaying as null when using location manager
===

I want to get current location's latitude and longitude. I used location manager for this. But it is displaying location as null and latitude and longitude as 0.0. I have used required permissions in manifest and gps connection. My code


    LocationdemoActivity.java::
    
    public class LocationdemoActivity extends Activity {
    
    	@Override
    	public void onCreate(Bundle savedInstanceState) {
    		super.onCreate(savedInstanceState);
    		setContentView(R.layout.main);
    		LocationManager mlocManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    		LocationListener mlocListener = new MyLocationListener();
    		mlocManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0,mlocListener);
    		mlocManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0,	0, mlocListener);
    		
    		Button buttonLocation = (Button) findViewById(R.id.buttonLocation);
    		buttonLocation.setOnClickListener(new View.OnClickListener() {
    			public void onClick(View view) {
    
    				Toast.makeText(
    						getApplicationContext(),
    						"loc:" + MyLocationListener.location + "latitude "
    								+ MyLocationListener.latitude + "longitude "
    								+ MyLocationListener.longitude, 5000).show();
    
    			}
    
    		});
    
    	}
    }
    
    
    
    
    MyLocationListener.java::
    
    
     public class MyLocationListener implements LocationListener {
    
    	public static double latitude;
    
    	public static double longitude;
    	public static Location location;
    
    	@Override
    	public void onLocationChanged(Location loc)
    	{
    		location = loc;
    		loc.getLatitude();
    		loc.getLongitude();
    		latitude = loc.getLatitude();
    		longitude = loc.getLongitude();
    	}
    	@Override
    	public void onProviderDisabled(String provider)
    	{
    	}
    	@Override
    	public void onProviderEnabled(String provider)
    	{
    	}
    	@Override
    	public void onStatusChanged(String provider, int status, Bundle extras)
    	{
    	}
    	protected boolean isRouteDisplayed() {
    		return false;
    	}
    }
    
    
    
    permissions in manifest::
    
    <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
     <uses-permission android:name="android.permission.ACCESS_MOCK_LOCATION"/>
     <uses-permission android:name="android.permission.CONTROL_LOCATION_UPDATES"/>

what would be the problem..????  Please help me... Thanks in advance..

