CheckedTextView error :android.content.res.Resources$NotFoundException: Resource ID #0x0

CheckedTextView error :android.content.res.Resources$NotFoundException: Resource ID #0x0

当我点击两次 checkedTextView 时,应用失败。有同名的问题。但我觉得我的错不一样。

android.content.res.Resources$NotFoundException: Resource ID #0x0

我的适配器

@Override
public void onBindViewHolder(@NonNull final CardTasarimTutucu holder, int position) {
    String word = words.get(position);
    holder.rowText.setText(word);
    holder.rowText.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (holder.rowText.isChecked()) {

                holder.rowText.setCheckMarkDrawable(0);
                holder.rowText.setChecked(false);
            } else {
                holder.rowText.setCheckMarkDrawable(R.drawable.ic_check_black_24dp);
                holder.rowText.setChecked(true);
            }
        }
    });
}

错误信息

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.sozluk, PID: 2926
android.content.res.Resources$NotFoundException: Resource ID #0x0

at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:190)
at android.content.res.Resources.getValue(Resources.java:1290)
at androidx.appcompat.widget.ResourceManagerInternal.createDrawableIfNeeded(ResourceManagerInternal.java:176)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:141)
at androidx.appcompat.widget.ResourceManagerInternal.getDrawable(ResourceManagerInternal.java:132)
at androidx.appcompat.content.res.AppCompatResources.getDrawable(AppCompatResources.java:104)
at androidx.appcompat.widget.AppCompatCheckedTextView.setCheckMarkDrawable(AppCompatCheckedTextView.java:69)
at com.example.sozluk.CardAdapter.onClick(CardAdapter.java:55)
at android.view.View.performClick(View.java:5637)
at android.view.View$PerformClick.run(View.java:22429)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

使用 setCheckMarkDrawable(null) 而不是 setCheckMarkDrawable(0) 来删除可绘制对象。