Variable ‘name1’ is accessed from within inner class, needs to be declared final 解决方法:把变量在点击事件的内部类之中定义 例:错误 正确: