亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Android:Field can be converted to a local varible.的解決辦法

 更新時間:2017年10月13日 09:42:18   作者:他叫自己MR張  
這篇文章主要介紹了Android:Field can be converted to a local varible.的解決辦法的相關(guān)資料,希望通過本文能幫助到大家,讓大家遇到這樣的問題輕松解決,需要的朋友可以參考下

Android:Field can be converted to a local varible.的解決辦法

前言:

使用 Android Studio 開發(fā) Android 有一段時間了,偶爾會碰到 AS 在一些私有變量上有黃色高亮提示Field can be converted to a local varible,有些強迫癥的我還是不希望看到這個黃色的高亮。百度沒查到什么有用的信息,還是用谷歌搜到了一些解答。

解析

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 來快速轉(zhuǎn)換成局部變量。

PS:還是需要英語好點啊,實際上看說明就能明白了,就不用這樣通過搜索才明白。

如有疑問請留言或者到本站社區(qū)交流討論,感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論