content: package com.rxjava2.android.samples.ui.operators;
  
  import android.os.Bundle;
  import android.util.Log;
  import android.widget.Button;
  import android.widget.TextView;
  
  import com.rxjava2.android.samples.R;
  import com.rxjava2.android.samples.utils.AppConstant;
  import com.rxjava2.android.samples.utils.ObserverAdapter;
  
  import androidx.annotation.Nullable;
  import androidx.appcompat.app.AppCompatActivity;
  import io.reactivex.Observable;
  import io.reactivex.Observer;
  import io.reactivex.disposables.Disposable;
  
  public abstract class TakeOperatorBaseActivity extends AppCompatActivity {
      private static final String TAG = TakeWhileExampleActivity.class.getSimpleName();
  
      private Button btn;
  
      protected TextView textView;
  
      @Override
      protected void onCreate(@Nullable Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_example);
          btn = findViewById(R.id.btn);
          textView = findViewById(R.id.textView);
  
          btn.setOnClickListener(view -> {
              doSomeWork();
          });
      }
  
      /**
       * Need to be override based on the operation.
       */
      abstract void doSomeWork();
  
      protected Observer<? super String> getObserver() {
          return new ObserverAdapter<String>() {
              @Override
              public void onSubscribe(Disposable d) {
                  Log.d(TAG, " onSubscribe : " + d.isDisposed());
              }
  
              @Override
              public void onNext(String value) {
                  textView.append(" onNext : value : " + value);
                  textView.append(AppConstant.LINE_SEPARATOR);
                  Log.d(TAG, " onNext value : " + value);
              }
  
              @Override
              public void onComplete() {
                  textView.append(" onComplete");
                  textView.append(AppConstant.LINE_SEPARATOR);
                  Log.d(TAG, " onComplete");
              }
          };
      }
  
  
      protected Observable<String> getStringObservable() {
          return Observable.just("Alpha", "Beta", "Cupcake", "Doughnut", "Eclair", "Froyo", "GingerBread",
                  "Honeycomb", "Ice cream sandwich");
      }
  
  }
  