It's due to one of those reasons:
1) Either you named a TextView
within your name like R.id.imageView2
, and therefore your findViewById()
method is returning it and it cannot be casted to an ImageView
(which is logical)
2) Either you have another R.id.imageView2
within your project which is a TextView
and same goes here. Remember that id
s doesn't have to be unique within your project, but things like these might happen.