title: Retrofit network response returning null in Rxjava2
body: <p>***This is the code and my response is returning null, I'm using RXjav2 observable and live data. I want to get current, my location is Lagos and it is queried in the retrofit interface. I'm using the weather stack API  </p>
  
  <p>2020-02-29 15:49:10.309 17988-17988/com.example.weatherapp D/networks: null</p>
  
  <hr>
  
  <pre><code>  data class Weather (
        @SerializedName("name")
        val location: String,
        @SerializedName("weather_descriptions")
        val description: List&lt;String&gt;,
        @SerializedName("temperature")
        val temperature: Long,
        @SerializedName("wind_speed")
        val windSpeed: Long,
        @SerializedName("wind_dir")
        val windDir: String,
        @SerializedName("precip")
        val precipitation: Long,
        @SerializedName("humidity")
        val humidity: Long,
        @SerializedName("visibility")
        val visibility: Long,
        @SerializedName("weather_icons")
        val icon: List&lt;String&gt;
    ): Parcelable
  
  
  
    data class Request(
        @SerializedName("language")
        val language: String,
        @SerializedName("query")
        val query: String,
        @SerializedName("type")
        val type: String,
        @SerializedName("unit")
        val unit: String
    ) 
  
  
  
  data class Location(
        @SerializedName("country")
        val country: String,
        @SerializedName("lat")
        val lat: String,
        @SerializedName("localtime")
        val localtime: String,
        @SerializedName("localtime_epoch")
        val localtime_epoch: Int,
        @SerializedName("lon")
        val lon: String,
        @SerializedName("name")
        val name: String,
        @SerializedName("region")
        val region: String,
        @SerializedName("timezone_id")
        val timezone_id: String,
        @SerializedName("utc_offset")
        val utc_offset: String
    )
  
  
  </code></pre>
  
  <p><strong>Response data class</strong></p>
  
  <pre><code> data class WeatherResponse(
      @SerializedName("current")
      val current: Weather,
      @SerializedName("location")
      val location: Location,
      @SerializedName("request")
      val request: Request
  )
  </code></pre>
  
  <p><strong>Network Interface</strong></p>
  
  <pre><code>   interface ApixuApi {
         @GET("current///")
         fun getWeather(@Query("access_key") api: String = Util.API_KEY,
                            @Query("query") location: String = "Lagos"): Observable&lt;WeatherResponse&gt; 
  
  
  
  
  </code></pre>
  
  <p><strong>Datasource Interface</strong></p>
  
  <pre><code>interface DataSource {
  
      fun getWeather(): LiveData&lt;WeatherResponse&gt;
  
      fun refreshWeather()
  
      fun saveWeather(weather: Weather)
  
      fun clearWeather()
  
  }
  </code></pre>
  
  <pre><code>
  
   package com.example.weatherapp.dataSource
  
   import android.util.Log
   import androidx.lifecycle.LiveData
   import androidx.lifecycle.MutableLiveData
   import com.example.weatherapp.model.Weather
   import com.example.weatherapp.model.WeatherResponse
   import com.example.weatherapp.network.ApixuApi
   import com.example.weatherapp.util.NetworkState
   import io.reactivex.android.schedulers.AndroidSchedulers
   import io.reactivex.disposables.CompositeDisposable
   import io.reactivex.schedulers.Schedulers
  
   class RemoteDataSource(private val api: ApixuApi, private val compositeDisposable: CompositeDisposable) : DataSource {
  
       private val _networkState = MutableLiveData&lt;NetworkState&gt;()
       val networkState: LiveData&lt;NetworkState&gt;
       get() = _networkState
  
       private val _apiResponse = MutableLiveData&lt;WeatherResponse&gt;()
       val apiResponse
       get() = _apiResponse
  
       override fun getWeather(): LiveData&lt;WeatherResponse&gt; {
           _networkState.postValue(NetworkState.LOADING)
  
           var data:Weather? = null
  
           try {
               compositeDisposable.add(
                   api.getWeather()
                       .observeOn(AndroidSchedulers.mainThread())
                       .subscribeOn(Schedulers.io())
                       .subscribe(
                           {
                           //  data = _apiResponse.value.current
                             // data =  it
                              //data =  _apiResponse.value!!.current
                               data = _apiResponse.value!!.current
                               Log.d("remotedd", _apiResponse.value!!.current.toString())
                               _networkState.postValue(NetworkState.LOADED)
                           },
                           {
                               _networkState.postValue(NetworkState.ERROR)
                               Log.d("networks", it.message.toString())
                           }
                       )
               )
  
           }catch (e: Exception){
               Log.d("networks", e.message.toString())
           }
           return apiResponse
       }
  
       override fun refreshWeather() {
           _apiResponse.value = getWeather().value
  
       }
  
       override fun saveWeather(weather: Weather) {
           TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
       }
  
       override fun clearWeather() {
           TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
       }
  
  
   }
  
  </code></pre>
  
  <p><strong>I need help on how to figure this out, my response is null</strong></p>