码迷,mamicode.com
首页 > 移动开发 > 详细

Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView异常解决

时间:2015-09-04 18:29:03      阅读:238      评论:0      收藏:0      [点我收藏+]

标签:

有时在修改xml文件时,全报这种错误,这个应该是缓存没得到及时更新导致的,可以通过以下方法解决:

Eclipse tends to mess up your resources every now and then. This leads to some odd behavior such as strings and images being swapped all over your app, and more commonly classCastException(s), which happen when Eclipse switches your Views‘ ids around.

A few solutions to that problem:

Clean your project.

Modify an xml layout file and save.

Delete your R file. (Don‘t worry it will be automatically generated again).

Basically anything that makes your project rebuild and re-generate the R file.

 

URL:http://stackoverflow.com/questions/11191040/android-java-lang-classcastexception-android-widget-imageview-cannot-be-cast-t

Android: java.lang.ClassCastException: android.widget.imageView cannot be cast to android.widget.textView异常解决

标签:

原文地址:http://www.cnblogs.com/mxm2005/p/4782104.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!