title: Fragment subscribe to Observer
body: <p>I'm trying to implement an Observer/Subscriber with RxJava for the first time.
  I get the compile error:   </p>
  
  <pre><code>cannot resolve method subscribe(android.support.v4.app.Fragment) 
  </code></pre>
  
  <p>on the line indicated below. So I'm not subscribing correctly.
  How do I do this?</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
  
          Fragment myFragment = mTabsPageAdapter.getItem(2);
  
          Observable&lt;String&gt; loadAndStoreDataObservable = Observable.create(
                  new Observable.OnSubscribe&lt;String&gt;() {
                      @Override
                      public void call(Subscriber&lt;? super String&gt; subscriber) {
                          try {           
                              &lt;get data from RESTful service&gt;
                              &lt;write data to SQLite db on device&gt;
  
                              subscriber.onNext("Done");
                              subscriber.onCompleted();
                          }
                          catch (Exception e) {
                              subscriber.onError(e);
                          }
                      }
                  }
          )
              .subscribeOn(Schedulers.io())
              .observeOn(AndroidSchedulers.mainThread())
              .subscribe(myFragment); // cannot resolve method subscribe(android.support.v4.app.Fragment)
      }
  }
  
  import android.support.v4.app.Fragment;
  public class MyFragment extends Fragment implements Observer&lt;String&gt; {
  
          @Override                         
          public void onNext(String s) {    
              System.out.println(s);        
          }                                 
  
          @Override                         
          public void onCompleted() {       
          }                                 
  
          @Override                         
          public void onError(Throwable e) {
          }
  }      
  </code></pre>
  
  <p>Edit: I changed the line suggested by Vladimir Mironov. This seems to be necessary but not sufficient. Implementing it I then get a compile error on the line after that:<br>
  <em>Incompatible types: Required rx.Observable
                       Found rx.Subscription</em></p>
  
  <p>It suggests casting to <code>(Observable&lt;String&gt;)</code> like so:</p>
  
  <pre><code>Observable&lt;String&gt; loadAndStoreDataObservable = (Observable&lt;String&gt;) Observable.create(...)
  </code></pre>
  
  <p>which does indeed compile error-free, but gives the runtime error:<br>
  <em>java.lang.ClassCastException: rx.observers.SafeSubscriber cannot be cast to rx.Observable</em></p>
  
  <p>Edit 2:
  I think it should be: <code>Subscription loadAndStoreDataObservable = ...</code></p>