title: Manually create an observable of an object in Kotlin and RX observable
body: <p>I have a written a function which should return <code>Observable&lt;GenericResponse&gt;</code>. I want to manually create the <code>Observable&lt;GenericResponse&gt;</code>. Is that possible?</p>
  <pre><code> fun notifyOnStand(serviceType: String, id: String, action: TimestampedAction): Observable&lt;GenericResponse&gt;? {
          if (libraryOfflineDBHelper.getIsNetworkAvailableNow()) {
              return api.serviceOrderOnStand(serviceType, id, action)
          } else {
              val onStandApiData = JsonObject()
              onStandApiData.addProperty(&quot;serviceType&quot;, serviceType)
              onStandApiData.addProperty(&quot;id&quot;, id)
              onStandApiData.addProperty(&quot;action&quot;, action.toString())
              var result: Int = 0
              launch {
                   result = offlineDatabaseManager.insertOfflineData(OfflineData(0, onStandApiData.toString(), &quot;notifyOnstand&quot;))
              }
              if(result &gt; 0) {
                  val genericResponse = GenericResponse(true)
                  return Observable&lt;genericResponse&gt; //***THIS IS WHAT I WANT TO RETURN
              }
          }
      } 
  
  public class GenericResponse {
  
      @Expose
      @OnComplete
      protected Boolean success = false;
  
      @Expose
      @OnComplete
      protected String error;
  
      public GenericResponse() {}
  
      public GenericResponse(Boolean success) {
          this.success = success;
      }
  
      public Boolean getSuccess() {
          return success;
      }
  
      public GenericResponse setSuccess(Boolean success) {
          this.success = success;
          return this;
      }
  
      public String getError() {
          return error;
      }
  
      public GenericResponse setError(String error) {
          this.error = error;
          return this;
      }
  }
  </code></pre>
  <p>Just an FYI on what this function is doing, It will check if there is network connection then it will call existing retrofit api calls which return an observable of GenericResponse so it works fine.
  If there is no network connection I insert data into the database and depending on that response, I want to manually create <code>Observable&lt;GenericResponse&gt;</code>.</p>
  <p>How can I do that?</p>