title: RxJava2 (Android): PublishSubject only emits once to activity?
body: <p>When publishing to a <code>PublishSubject</code>, only the first object published is emitted in my program. A little context of my program:</p>
  
  <p>I have <code>SomeActivity</code>, with a <code>RecyclerView</code>. In my <code>Recycler.ViewHolder</code> I have on click. In the onclick method, I publish an object to the PublishSubject.</p>
  
  <p>In SomeActivity, I subscribe to the PublishSubject in the <code>onCreate</code>. When I run my app, I can see that only the first published object is received in SomeActivity. The PublishSubject is wrapped in a simple custom "RxBus" which I use to communicate in my app between different components (Instead of using interfaces etc).</p>
  
  <p><strong>Here is how I publish in the viewholder:</strong></p>
  
  <pre><code>@Override
  public void onClick(View v) {
      RxBus.publish(RxBus.GAME_TOUCHED, new GameEvent(data));
  }
  </code></pre>
  
  <p><strong>Here is how I subscribe in SomeActivity:</strong></p>
  
  <pre><code>RxBus.subscribe(RxBus.GAME_TOUCHED, this, o -&gt; {
          GameEvent gameEvent = (GameEvent) o;
          //Do something here...
      });
  </code></pre>
  
  <p><strong>Here is my "RxBus":</strong></p>
  
  <pre><code>public final class RxBus {
  
      private static RxBus INSTANCE;
      private static SparseArray&lt;PublishSubject&lt;Object&gt;&gt; subjectMap = new SparseArray&lt;&gt;();
      private static Map&lt;Object, CompositeDisposable&gt; subscriptionsMap = new HashMap&lt;&gt;();
  
      public static final int GAME_TOUCHED = 7;
  
      @Retention(SOURCE)
      @IntDef({GAME_TOUCHED})
      @interface Subject {
      }
  
      private RxBus() {
      }
  
      public static synchronized RxBus get() {
          if (INSTANCE == null) {
              INSTANCE = new RxBus();
          }
          return INSTANCE;
      }
  
      @NonNull
      private static PublishSubject&lt;Object&gt; getSubject(@Subject int subjectCode) {
          PublishSubject&lt;Object&gt; subject = subjectMap.get(subjectCode);
          if (subject == null) {
              subject = PublishSubject.create();
              subject.subscribeOn(AndroidSchedulers.mainThread());
              subjectMap.put(subjectCode, subject);
          }
  
          return subject;
      }
  
      @NonNull
      private static CompositeDisposable getCompositeDisposable(@NonNull Object object) {
          CompositeDisposable compositeDisposable = subscriptionsMap.get(object);
          if (compositeDisposable == null) {
              compositeDisposable = new CompositeDisposable();
              subscriptionsMap.put(object, compositeDisposable);
          }
  
          return compositeDisposable;
      }
  
      public static void subscribe(@Subject int subject, @NonNull Object lifecycle, @NonNull Consumer&lt;Object&gt; action) {
          Disposable disposable = getSubject(subject).subscribe(action);
          getCompositeDisposable(lifecycle).add(disposable);
      }
  
      public static void unregister(@NonNull Object lifecycle) {
          CompositeDisposable compositeDisposable = subscriptionsMap.remove(lifecycle);
          if (compositeDisposable != null) {
              compositeDisposable.dispose();
          }
      }
  
      public static void publish(@Subject int subject, @NonNull Object message) {
          getSubject(subject).onNext(message);
      }
  
  }
  </code></pre>
  
  <p>In short, subscribe to a certain "eventype" only recieved/emitted once for the activity. </p>
  
  <p>Any suggestions?</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>public class QuestionAdapter extends RecyclerView.Adapter&lt;QuestionHolder&gt; {
  
      private final List&lt;Game&gt; games = new ArrayList&lt;&gt;();
      private final Context context;
  
      public QuestionAdapter(Context context) {
          this.context = context;
      }
  
      @NonNull
      @Override
      public QuestionHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
          QuestionHolder questionHolder = new QuestionHolder(R.layout.layout_item_question, parent);
          return questionHolder;
      }
  
      @Override
      public void onBindViewHolder(@NonNull QuestionHolder holder, int position) {
          holder.bind(games.get(position));
      }
  
      @Override
      public int getItemCount() {
          return games.size();
      }
  
      public void setData(List&lt;Game&gt; newGames){
          games.clear();
          games.addAll(newGames);
          notifyDataSetChanged();
      }
  
      public void deleteItem(int position) {
          RxBus.publish(RxBus.DELETE_GAME, new GameEvent(games.get(position)));
          notifyDataSetChanged(); //restore view if not/after deleted
      }
  
      public Context getContext(){
          return context;
      }
  
  }
  </code></pre>
  
  <p><strong>EDIT 2:</strong></p>
  
  <pre><code>RxBus.subscribe(RxBus.DELETE_GAME, this, o -&gt; {
              GameEvent gameEvent = (GameEvent) o;
              Game game = gameEvent.getGame();
              MaterialDialog.Builder builder = CustomMaterialDialog.areYouSure("Delete game?", this)
                      .onNegative((dialog, which) -&gt; dialog.dismiss())
                      .onPositive((dialog, which) -&gt; {
                          dialog.dismiss();
                          viewModel.deleteGame(game);
                      });
              showCustomDialog(builder);
          });
  </code></pre>
  
  <p><strong>EDIT 3:</strong></p>
  
  <p>Changes in Adapter:</p>
  
  <pre><code>@Override
  public void onBindViewHolder(@NonNull QuestionHolder holder, int position) {
      holder.bind(games.get(position));
      holder.getItemView().setOnClickListener(v -&gt; {
          Game game = holder.getData();
          RxBus.publish(RxBus.GAME_TOUCHED, new GameEvent(game));
      });
  }
  </code></pre>
  
  <p>And added this to viewholder:</p>
  
  <pre><code>public View getItemView(){
      return itemView;
  }
  </code></pre>