Reputation: 365
I trying to cast a viewObject to TextView
object with this code:
TextView textView = (TextView) GetViewWithParams(Object);
The function "GetViewWithParams" returns viewObject. But when I run it I got this exception:
java.lang.ClassCastException: android.view.View cannot be cast to android.widget.TextView
How can I fix it?
Upvotes: 0
Views: 662
Reputation: 1379
Try this -
TextView textView = (TextView) findViewById(R.id.YOUR_TEXTVIEW_ID);
Upvotes: 1