i am try to get my current location in android but this shows wrong. And also try to get my location following code but it's not working : 

> **i am usjing this code but it is not working.**
> 
>     
> 
>     locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
>                     if (locationManager.isProviderEnabled(LocationManager.NETWORK_PROVIDER))
> {
>                         if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) !=
> PackageManager.PERMISSION_GRANTED &&
> ActivityCompat.checkSelfPermission(this,
> Manifest.permission.ACCESS_COARSE_LOCATION) !=
> PackageManager.PERMISSION_GRANTED) {
>                             // TODO: Consider calling
>                             //    ActivityCompat#requestPermissions
>                             // here to request the missing permissions, and then overriding
>                             //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
>                             //                                          int[] grantResults)
>                             // to handle the case where the user grants the permission. See the documentation
>                             // for ActivityCompat#requestPermissions for more details.
>                             return;
>                         }
>                         locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,
> 0, 0, new LocationListener() {
>                             @Override
>                             public void onLocationChanged(Location location) {
>                                 //get latitude
>                                 double latitude = location.getLatitude();
>                                 //get Longtitude
>                                 double longitude = location.getLongitude();
>             
>             
>                                 LatLng latLng = new LatLng(latitude, longitude);
>             
>             //                    Toast.makeText(getApplicationContext(), latitude+" "+longitude,
> Toast.LENGTH_LONG).show();
>             
>                                 Geocoder geocoder = new Geocoder(getApplicationContext());
>                                 try {
>                                     List<Address> addresses = geocoder.getFromLocation(latitude, longitude, 1);
>                                     String str = addresses.get(0).getLocality() + ",";
>                                     str += addresses.get(0).getCountryName();
>                                     mMap.addMarker(new MarkerOptions().position(latLng).title(str));
>                                     mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
>                                 } catch (IOException e) {
>                                     e.printStackTrace();
>                                 }
>                             }
>             
>                             @Override
>                             public void onStatusChanged(String provider, int status, Bundle extras) {
>             
>                             }
>             
>                             @Override
>                             public void onProviderEnabled(String provider) {
>             
>                             }
>             
>                             @Override
>                             public void onProviderDisabled(String provider) {
>             
>                             }
>                         });
>                     }
>                     else if(locationManager.isProviderEnabled(LocationManager.GPS_PROVIDER))
>                     {
>                         locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
> 0, 0, new LocationListener() {
>                             @Override
>                             public void onLocationChanged(Location location) {
>                                 //get latitude
>                                 double latitude = location.getLatitude();
>                                 //get Longtitude
>                                 double longitude = location.getLongitude();
>             
>                                 LatLng latLng = new LatLng(latitude, longitude);
>             
>             
>                                 Geocoder geocoder = new Geocoder(getApplicationContext());
>                                 try {
>                                     List<Address> addresses = geocoder.getFromLocation(latitude,longitude,1);
>                                     String str = addresses.get(0).getLocality()+",";
>                                     str +=addresses.get(0).getCountryName();
>                                     mMap.addMarker(new MarkerOptions().position(latLng).title(str));
>                                     mMap.moveCamera(CameraUpdateFactory.newLatLngZoom(latLng, 18));
>                                 } catch (IOException e) {
>                                     e.printStackTrace();
>                                 }
>                             }
>             
>                             @Override
>                             public void onStatusChanged(String provider, int status, Bundle extras) {
>             
>                             }
>             
>                             @Override
>                             public void onProviderEnabled(String provider) {
>             
>                             }
>             
>                             @Override
>                             public void onProviderDisabled(String provider) {
>             
>                             }
>                         });
> 
> 
> **how to solve this problem**