解析
Field can be converted to a local varible
的完整说明是:
This inspection searches for redundant class fields that can be replaced with local variables,if all local usages of a field are preceded by assignments to that field,the field can be removed and its usages replaced with local variables.
意思是检测到这个变量可以使用局部变量替换,建议删除并写成局部变量。
解决方案
删除private XXX XXX;
这句,并在使用的地方直接声明和实例化。
在 Android Studio for Mac
里可以直接使用快捷键 alt + enter
来快速转换成局部变量。
转载自:https://blog.csdn.net/ys743276112/article/details/50517524