3

私は RxBinding を使用しており、アイテムを再利用する onBindViewHolder メソッドの RecyclerView アダプターでサブスクリプションを作成しています。サブスクライバーを EditText オブジェクトに既に割り当てているかどうかを確認し、その場合はそのサブスクリプションを削除する簡単な方法はありますか?

私のコードは次のようになります

public void onBindViewHolder(final ItemViewHolder holder, int position) {

    holder.text.setText(mProvider.get(position).text);
    Subscription textSub = RxTextView.textChanges(holder.text).subscribe(new Action1<CharSequence>() {
        @Override
        public void call(CharSequence charSequence) {
            ...
        }
    });
    subscriptions.add(textSub);
}
4

1 に答える 1