1. 程式人生 > >Resources$NotFoundException資源文件沒有找到

Resources$NotFoundException資源文件沒有找到

搜索 lock 錯誤類型 class 編譯器 沒有 出現 .get ttext

錯誤類型:

android.content.res.Resources$NotFoundException: String resource ID #0x1
at android.content.res.Resources.getText(Resources.java:229)
at android.widget.TextView.setText(TextView.java:3620)

報錯的就是下面這個代碼:

tv_app_lock.setText(mAppLockList.size());

setText();方法應該傳入字符串,這裏傳入了一個int,編譯器默認將int當做資源文件去搜索,當然就會出現Resources$NotFoundException

必須傳入字符串,例如可以修改為:

tv_app_lock.setText(mAppLockList.size()+"");

Resources$NotFoundException資源文件沒有找到