Java 错误: 找不到符号 "noQuit" - 解决方法
public static final class DoneRunnable implements Runnable {\n private final WeakReference<Context> mContext;\n private final int noQuit;\n\n protected DoneRunnable(Context context, int noQuit) {\n mContext = new WeakReference<Context>(context);\n this.noQuit = noQuit;\n }\n\n @Override\n public void run() {\n if (noQuit == 1 && LanguageUtil.isDomestic()){\n if(LanguageUtil.isDomestic()) {\n ToastUtil.showToast(mContext.get(), MSG_noQuit_CN);\n } else {\n ToastUtil.showToast(mContext.get(), MSG_noQuit);\n }\n }else{\n if(LanguageUtil.isDomestic()) {\n ToastUtil.showToast(mContext.get(), MSG_CN);\n } else {\n ToastUtil.showToast(mContext.get(), MSG);\n }\n }\n }\n}这个错误是因为在DoneRunnable类中的run()方法中,没有定义noQuit变量。你需要在DoneRunnable类的成员变量中定义noQuit变量,并在构造函数中初始化它。修改代码如下:\n\njava\npublic static final class DoneRunnable implements Runnable {\n private final WeakReference<Context> mContext;\n private final int noQuit;\n\n protected DoneRunnable(Context context, int noQuit) {\n mContext = new WeakReference<Context>(context);\n this.noQuit = noQuit;\n }\n\n @Override\n public void run() {\n if (noQuit == 1 && LanguageUtil.isDomestic()){\n if(LanguageUtil.isDomestic()) {\n ToastUtil.showToast(mContext.get(), MSG_noQuit_CN);\n } else {\n ToastUtil.showToast(mContext.get(), MSG_noQuit);\n }\n }else{\n if(LanguageUtil.isDomestic()) {\n ToastUtil.showToast(mContext.get(), MSG_CN);\n } else {\n ToastUtil.showToast(mContext.get(), MSG);\n }\n }\n }\n}\n\n\n现在,DoneRunnable类中定义了noQuit变量,并在构造函数中进行了初始化。这样就可以解决找不到符号的错误。
原文地址: https://www.cveoy.top/t/topic/pTQf 著作权归作者所有。请勿转载和采集!