Reputation: 13855
I am getting the error TextView cannot be cast to EditText.
This occurs when I change the order of the XML so that EditText is in the correct (desired) place.
It happens on this line:
EditText edtPassword = (EditText)findViewById(R.id.EditText03);
Im baffled because they are not linked in any way.
<EditText
android:id="@+id/EditText03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:width="160dip" >
</EditText>
<TextView
android:id="@+id/TextView03"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="UserName:" >
</TextView>
<TextView
android:id="@+id/TextView04"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Password:">
</TextView>
// IF I MOVE AN EditText03 Here instead it just crashes.
Upvotes: 0
Views: 97
Reputation: 40416
i think it happened sometimes when same id for TextView and EditText in R.java file
so your code refrences the R file but its wrong refrence as per above i described.
you should use unique id for each view in your project.
or if you have unique id for all view in your prj then clean and run your project.
Upvotes: 1