简体   繁体   English

CheckedTextView 错误:android.content.res.Resources$NotFoundException:资源 ID #0x0

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

When I click checkedTextView twice, app fails.当我两次单击 checkedTextView 时,应用程序失败。 there are questions with the same name.有同名的问题。 But I think my fault is different.但我认为我的错是不同的。

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

My adapter我的适配器

@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);
            }
        }
    });
}

Error message错误信息

E/AndroidRuntime: FATAL EXCEPTION: main E/AndroidRuntime: 致命异常: main
Process: com.example.sozluk, PID: 2926进程:com.example.sozluk,PID:2926
android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources$NotFoundException:资源 ID #0x0

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

Use setCheckMarkDrawable(null) instead of setCheckMarkDrawable(0) to remove the drawable.使用setCheckMarkDrawable(null)而不是setCheckMarkDrawable(0)删除可绘制对象。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 android.content.res.Resources $ NotFoundException:资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0x0 Android错误 - android.content.res.Resources$NotFoundException: Resource ID #0x0 Android error android.content.res.Resources $ NotFoundException:Spinner中的资源ID#0x0 - android.content.res.Resources$NotFoundException: Resource ID #0x0 in Spinner 适配器有问题。 android.content.res.Resources $ NotFoundException:资源ID#0x0 - Having trouble with adapters. android.content.res.Resources$NotFoundException: Resource ID #0x0 GridView.FATAL例外:main android.content.res.Resources $ NotFoundException:字符串资源ID#0x0 - GridView.FATAL EXCEPTION: main android.content.res.Resources$NotFoundException: String resource ID #0x0 android.content.res.Resources$NotFoundException:使用 RecyclerView 时出现资源 ID #0x0 异常 - android.content.res.Resources$NotFoundException: Resource ID #0x0 exception while using RecyclerView android.content.res.Resources$NotFoundException: 字符串资源 ID #0x0 - android.content.res.Resources$NotFoundException: String resource ID #0x0 android.content.res.Resources $ NotFoundException:资源ID#0x0可绘制 - android.content.res.Resources$NotFoundException: Resource ID #0x0 drawable android.content.res.Resources $ NotFoundException:资源ID#0x0 java异常 - android.content.res.Resources$NotFoundException: Resource ID #0x0 java exception 尝试在 Android Studio 中打开 Unity 活动会产生 android.content.res.Resources$NotFoundException: String resource ID #0x0 - Trying to open an Unity activity inside Android Studio yields android.content.res.Resources$NotFoundException: String resource ID #0x0
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM