title: Cannot resolve Symbol "response"
body: <p>I'm new to Retrofit, I have an activity hosting 3 fragments for a weather app. My FirstFragment is where the
  current weather data will be displayed using OpenWeatherMap One call API <a href="https://openweathermap.org/api/one-call-api" rel="nofollow noreferrer">https://openweathermap.org/api/one-call-api</a>. I noticed that retrofit request calls cannot be made on the fragment class, so
  I tried using my Activity class and everything worked properly except these following lines:</p>
  <pre><code>call.enqueue(new Callback&lt;WeatherResponse&gt;() {
          @Override
          public void onResponse(@NonNull Call &lt; WeatherResponse &gt; call, @NonNull Response &lt; WeatherResponse &gt; response) {
              if (response.code() == 200) {
                  WeatherResponse weatherResponse = response.body();
                  assert weatherResponse != null;
  
              time_zone.setText(response.body().getTimezone());
              time_field.setText(response.body().getCurrent.getDt());
              current_temp.setText(response.body().getCurrent().getTemp()+&quot; ℃&quot;);
              current_output.setText(response.body().getCurrent().getWeather().getDescription);
              rise_time.setText(response.body().getCurrent().getSunrise()+&quot; AM&quot;);
              set_time.setText(response.body().getCurrent().getSunset()+&quot; PM&quot;);
              temp_out.setText(response.body().getCurrent().getTemp()+&quot; ℃&quot;);
              Press_out.setText(response.body().getCurrent().getPressure()+&quot; hpa&quot;);
              Humid_out.setText(response.body().getCurrent().getHumidity()+&quot; %&quot;);
              Ws_out.setText(response.body().getCurrent).getWind_speed()+&quot; Km/h&quot;);
              Visi_out.setText(response.body().getCurrent().getVisibility()+&quot; m&quot;);
              UV_out.setText(response.body().getCurrent().getUvi()); 
  </code></pre>
  <p>showing error <code>Cannot resolve Symbol &quot;response&quot;</code>. What can be done to fix it, please?
  My full code:
  <strong>HomeActivity.java</strong></p>
  <pre><code>public class HomeActivity extends AppCompatActivity {
      public static String BaseUrl = &quot;http://api.openweathermap.org/&quot;;
      public static String AppId = &quot;&quot;;
      public static String lat = &quot;9.0574&quot;;
      public static String lon = &quot;7.4898&quot;;
      // User Timezone name, current time, current temperature, current condition, sunrise, sunset, temperature, pressure, humidity, wind_speed, visibility, UV Index
      TextView time_zone, time_field, current_temp, current_output, rise_time, set_time, temp_out, Press_out, Humid_out, Ws_out, Visi_out, UV_out;
      ConstraintLayout constraintLayout;
      public static int count=0;
      int[] drawable =new int[]{R.drawable.dubai,R.drawable.central_bank_of_nigeria,R.drawable.eiffel_tower,R.drawable.hong_kong,R.drawable.statue_of_liberty};
      Timer _t;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home);
  
          time_zone = findViewById(R.id.textView9);
          time_field = findViewById(R.id.textView4);
          current_temp = findViewById(R.id.textView10);
          current_output = findViewById(R.id.textView11);
          rise_time = findViewById(R.id.textView25);
          set_time = findViewById(R.id.textView26);
          temp_out = findViewById(R.id.textView28);
          Press_out = findViewById(R.id.textView29);
          Humid_out = findViewById(R.id.textView30);
          Ws_out = findViewById(R.id.textView33);
          Visi_out = findViewById(R.id.textView34);
          UV_out = findViewById(R.id.textView35);
  
          BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView);
          NavController navController = Navigation.findNavController(this, R.id.fragment);
          NavigationUI.setupWithNavController(bottomNavigationView, navController);
  
          constraintLayout = findViewById(R.id.layout);
          constraintLayout.setBackgroundResource(R.drawable.dubai);
          _t = new Timer();
          _t.scheduleAtFixedRate(new TimerTask() {
              @Override
              public void run() {
                  runOnUiThread(new Runnable() { // run on ui thread
                      @Override
                      public void run() {
                          if (count &lt; drawable.length) {
  
                              constraintLayout.setBackgroundResource(drawable[count]);
                              count = (count + 1) % drawable.length;
                          }
                      }
                  });
              }
          }, 5000, 5000);
      }
      Retrofit retrofit = new Retrofit.Builder()
              .baseUrl(BaseUrl)
              .addConverterFactory(GsonConverterFactory.create())
              .build();
      WeatherService service = retrofit.create(WeatherService.class);
      Call&lt;WeatherResponse&gt; call = service.getCurrentWeatherData(lat, lon, AppId);
          call.enqueue(new Callback&lt;WeatherResponse&gt;() {
          @Override
          public void onResponse(@NonNull Call &lt; WeatherResponse &gt; call, @NonNull Response &lt; WeatherResponse &gt; response) {
              if (response.code() == 200) {
                  WeatherResponse weatherResponse = response.body();
                  assert weatherResponse != null;
  
                  time_zone.setText(response.body().getTimezone());
                  time_field.setText(response.body().getCurrent.getDt());
                  current_temp.setText(response.body().getCurrent().getTemp()+&quot; ℃&quot;);
                  current_output.setText(response.body().getCurrent().getWeather().getDescription);
                  rise_time.setText(response.body().getCurrent().getSunrise()+&quot; AM&quot;);
                  set_time.setText(response.body().getCurrent().getSunset()+&quot; PM&quot;);
                  temp_out.setText(response.body().getCurrent().getTemp()+&quot; ℃&quot;);
                  Press_out.setText(response.body().getCurrent().getPressure()+&quot; hpa&quot;);
                  Humid_out.setText(response.body().getCurrent().getHumidity()+&quot; %&quot;);
                  Ws_out.setText(response.body().getCurrent).getWind_speed()+&quot; Km/h&quot;);
                  Visi_out.setText(response.body().getCurrent().getVisibility()+&quot; m&quot;);
                  UV_out.setText(response.body().getCurrent().getUvi());
  
              }
          }
      }
  }
  </code></pre>
  <p><strong>WeatherService.java</strong></p>
  <pre><code>public interface WeatherService {
      @GET(&quot;data/2.5/weather?&quot;)
      Call&lt;WeatherResponse&gt; getCurrentWeatherData(@Query(&quot;lat&quot;) String lat, @Query(&quot;lon&quot;) String lon, @Query(&quot;APPID&quot;) String app_id);
  }
  </code></pre>
  <p><strong>JSON Response</strong>:</p>
  <pre><code>{
     &quot;lat&quot;:9.08,
     &quot;lon&quot;:7.4,
     &quot;timezone&quot;:&quot;Africa/Lagos&quot;,
     &quot;timezone_offset&quot;:3600,
     &quot;current&quot;:{
        &quot;dt&quot;:1609157237,
        &quot;sunrise&quot;:1609134244,
        &quot;sunset&quot;:1609175993,
        &quot;temp&quot;:305.15,
        &quot;feels_like&quot;:304.63,
        &quot;pressure&quot;:1012,
        &quot;humidity&quot;:29,
        &quot;dew_point&quot;:284.9,
        &quot;uvi&quot;:8.32,
        &quot;clouds&quot;:82,
        &quot;visibility&quot;:5000,
        &quot;wind_speed&quot;:1.5,
        &quot;wind_deg&quot;:200,
        &quot;weather&quot;:[
           {
              &quot;id&quot;:721,
              &quot;main&quot;:&quot;Haze&quot;,
              &quot;description&quot;:&quot;haze&quot;,
              &quot;icon&quot;:&quot;50d&quot;
           }
        ]
     }
  </code></pre>
  <p>I converted my JSON to GSON using <a href="http://www.jsonschema2pojo.org/" rel="nofollow noreferrer">http://www.jsonschema2pojo.org/</a></p>
  <p><strong>Current.java</strong>:</p>
  <pre><code>public class Current {
      @SerializedName(&quot;dt&quot;)
      @Expose
      private Integer dt;
      @SerializedName(&quot;sunrise&quot;)
      @Expose
      private Integer sunrise;
      @SerializedName(&quot;sunset&quot;)
      @Expose
      private Integer sunset;
      @SerializedName(&quot;temp&quot;)
      @Expose
      private Double temp;
      @SerializedName(&quot;feels_like&quot;)
      @Expose
      private Double feelsLike;
      @SerializedName(&quot;pressure&quot;)
      @Expose
      private Integer pressure;
      @SerializedName(&quot;humidity&quot;)
      @Expose
      private Integer humidity;
      @SerializedName(&quot;dew_point&quot;)
      @Expose
      private Double dewPoint;
      @SerializedName(&quot;uvi&quot;)
      @Expose
      private Double uvi;
      @SerializedName(&quot;clouds&quot;)
      @Expose
      private Integer clouds;
      @SerializedName(&quot;visibility&quot;)
      @Expose
      private Integer visibility;
      @SerializedName(&quot;wind_speed&quot;)
      @Expose
      private Double windSpeed;
      @SerializedName(&quot;wind_deg&quot;)
      @Expose
      private Integer windDeg;
      @SerializedName(&quot;weather&quot;)
      @Expose
      private List&lt;Weather&gt; weather = null;
  
      public Integer getDt() {
          return dt;
      }
  
      public void setDt(Integer dt) {
          this.dt = dt;
      }
  
      public Integer getSunrise() {
          return sunrise;
      }
  
      public void setSunrise(Integer sunrise) {
          this.sunrise = sunrise;
      }
  
      public Integer getSunset() {
          return sunset;
      }
  
      public void setSunset(Integer sunset) {
          this.sunset = sunset;
      }
  
      public Double getTemp() {
          return temp;
      }
  
      public void setTemp(Double temp) {
          this.temp = temp;
      }
  
      public Double getFeelsLike() {
          return feelsLike;
      }
  
      public void setFeelsLike(Double feelsLike) {
          this.feelsLike = feelsLike;
      }
  
      public Integer getPressure() {
          return pressure;
      }
  
      public void setPressure(Integer pressure) {
          this.pressure = pressure;
      }
  
      public Integer getHumidity() {
          return humidity;
      }
  
      public void setHumidity(Integer humidity) {
          this.humidity = humidity;
      }
  
      public Double getDewPoint() {
          return dewPoint;
      }
  
      public void setDewPoint(Double dewPoint) {
          this.dewPoint = dewPoint;
      }
  
      public Double getUvi() {
          return uvi;
      }
  
      public void setUvi(Double uvi) {
          this.uvi = uvi;
      }
  
      public Integer getClouds() {
          return clouds;
      }
  
      public void setClouds(Integer clouds) {
          this.clouds = clouds;
      }
  
      public Integer getVisibility() {
          return visibility;
      }
  
      public void setVisibility(Integer visibility) {
          this.visibility = visibility;
      }
  
      public Double getWindSpeed() {
          return windSpeed;
      }
  
      public void setWindSpeed(Double windSpeed) {
          this.windSpeed = windSpeed;
      }
  
      public Integer getWindDeg() {
          return windDeg;
      }
  
      public void setWindDeg(Integer windDeg) {
          this.windDeg = windDeg;
      }
  
      public List&lt;Weather&gt; getWeather() {
          return weather;
      }
  
      public void setWeather(List&lt;Weather&gt; weather) {
          this.weather = weather;
      }
  }
  </code></pre>
  <p><strong>Weather.java</strong>:</p>
  <pre><code>public class Weather {
  @SerializedName(&quot;id&quot;)
  @Expose
  private Integer id;
  @SerializedName(&quot;main&quot;)
  @Expose
  private String main;
  @SerializedName(&quot;description&quot;)
  @Expose
  private String description;
  @SerializedName(&quot;icon&quot;)
      @Expose
      private String icon;
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public String getMain() {
          return main;
      }
  
      public void setMain(String main) {
          this.main = main;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public String getIcon() {
          return icon;
      }
  
      public void setIcon(String icon) {
          this.icon = icon;
      }
  }
  </code></pre>
  <p><strong>WeatherResponse.java</strong>:</p>
  <pre><code>public class WeatherResponse {
  @SerializedName(&quot;lat&quot;)
  @Expose
  private Double lat;
  @SerializedName(&quot;lon&quot;)
  @Expose
  private Double lon;
  @SerializedName(&quot;timezone&quot;)
  @Expose
  private String timezone;
  @SerializedName(&quot;timezone_offset&quot;)
  @Expose
  private Integer timezoneOffset;
  @SerializedName(&quot;current&quot;)
      @Expose
      private Current current;
  
      public Double getLat() {
          return lat;
      }
  
      public void setLat(Double lat) {
          this.lat = lat;
      }
  
      public Double getLon() {
          return lon;
      }
  
      public void setLon(Double lon) {
          this.lon = lon;
      }
  
      public String getTimezone() {
          return timezone;
      }
  
      public void setTimezone(String timezone) {
          this.timezone = timezone;
      }
  
      public Integer getTimezoneOffset() {
          return timezoneOffset;
      }
  
      public void setTimezoneOffset(Integer timezoneOffset) {
          this.timezoneOffset = timezoneOffset;
      }
  
      public Current getCurrent() {
          return current;
      }
  
      public void setCurrent(Current current) {
          this.current = current;
      }
  
  }
  </code></pre>
  <p>I also want to make my fragment class make use of the Activity data, how to do that, please?</p>