title: Android Retrofit failure()
body: <p>Hello I am trying to make an app that will get the lat long from web url</p>
  
  <p><a href="http://akshay.site90.net/getLats.php?username=rakesh" rel="nofollow">http://akshay.site90.net/getLats.php?username=rakesh</a></p>
  
  <p>And result will be in the form </p>
  
  <pre><code>{"lat":"30.1328064900","longitude":"77.2865304300"}
  </code></pre>
  
  <p>I am doing this using Android Retrofit..
  But When I am opening the app the <strong>failure()</strong> of retrofit is called everytime but not the <strong>success()</strong>
  I dont know what is going wrong..
  it should call <strong>onSucces()</strong></p>
  
  <pre><code>interface  api.java
  package com.example.akshay.parentapp;
  
      import retrofit.http.GET;
  
      /**
       * Created by Akshay on 9/8/2015.
       */
      public interface api {
          @GET("/getLats.php?username=rakesh")
          public void getData( retrofit.Callback&lt;getGSONData&gt; response);
      }
  </code></pre>
  
  <p><strong>getGSONData.java</strong></p>
  
  <pre><code>package com.example.akshay.parentapp;
  
  import android.util.Log;
  
  import com.google.gson.annotations.Expose;
  import com.google.gson.annotations.SerializedName;
  
  /**
   * Created by Akshay on 9/8/2015.
   */
  public class getGSONData {
  
      @SerializedName("lat")
      @Expose
      public String lat;
  
      @SerializedName("longitude")
      @Expose
      public String longitude;
  
      public void getlat(String lat) {
          this.lat = lat;
      }
  
      public Double setLat() {
          Log.e("====LAT", lat);
          return Double.parseDouble(lat);
      }
  
      public void getlongitude(String longitude) {
          this.longitude = longitude;
      }
  
      public Double setLong() {
          Log.e("====LONG", longitude);
          return Double.parseDouble(longitude);
      }
  
  }
  </code></pre>
  
  <p><strong>Map.java</strong></p>
  
  <pre><code>package com.example.akshay.parentapp;
  import android.graphics.Color;
  import android.location.Location;
  import android.location.LocationListener;
  import android.location.LocationManager;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.util.Log;
  
  import com.google.android.gms.maps.CameraUpdate;
  import com.google.android.gms.maps.CameraUpdateFactory;
  import com.google.android.gms.maps.GoogleMap;
  import com.google.android.gms.maps.SupportMapFragment;
  import com.google.android.gms.maps.model.LatLng;
  import com.google.android.gms.maps.model.PolylineOptions;
  
  import retrofit.Callback;
  import retrofit.RestAdapter;
  import retrofit.RetrofitError;
  import retrofit.client.Response;
  
  /**
   * Created by Akshay on 8/31/2015.
   */
  public class Map extends FragmentActivity {
      public final String URL = "http://akshay.site90.net";
      LatLng prev = null;
      LatLng current = null;
      int flag = 0;
      GoogleMap googleMap;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.map);
          googleMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
        LocationManager  locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
          locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000, 0, new LocationListener() {
              @Override
              public void onLocationChanged(Location location) {
                  Log.e("OnLocationChanged" , "===========0");
                  RestAdapter restAdapter = new RestAdapter.Builder().setEndpoint(URL).build();
                 api api = restAdapter.create(api.class);
                  api.getData( new Callback&lt;getGSONData&gt;() {
                      @Override
                      public void success(getGSONData getGSONData, Response response) {
                          Double LAT = getGSONData.setLat();
                          Double LONG = getGSONData.setLong();
                          current =  new LatLng(LAT , LONG);
  
                         Log.e("===LAT" , String.valueOf(LAT));
                          Log.e("===LONG" , String.valueOf(LONG));
                           if (flag == 0 &amp; LAT!=null &amp; LONG != null)
                           {
                               prev = current;
                               flag = 1;
                           }
                          CameraUpdate cm = CameraUpdateFactory.newLatLngZoom(current, 18);
  
                          PolylineOptions polylineOptions = new PolylineOptions();
                          polylineOptions.color(Color.RED).add(prev,current).width(20).visible(true);
                          googleMap.addPolyline(polylineOptions);
                          googleMap.animateCamera(cm);
                          prev = current;
                          current = null;
  
  
                      }
  
                      @Override
                      public void failure(RetrofitError error) {
  Log.e("====" , "Something gone wrong");
                      }
                  });
  
              }
  
              @Override
              public void onStatusChanged(String provider, int status, Bundle extras) {
  
              }
  
              @Override
              public void onProviderEnabled(String provider) {
  
              }
  
              @Override
              public void onProviderDisabled(String provider) {
  
              }
          });
  
  
      }
  }
  </code></pre>