I am trying to retrieve my current location on the button click in an editbox using gps or network..i have tried all possible methods which i found in tutorials and older posts.
Another reason for getting null back from locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
would be if your network provider was turned off. On my phone this is toggled via Settings -> Location -> Use wireless networks.
EDIT:
You could also try:
LocationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER)
to see if the network provider is enabled or
LocationManager.getProviders(true)
to return any enabled providers.
See http://developer.android.com/reference/android/location/LocationManager.htm for more info