error: unexpected cast to GameBoard: layout tag was ImageView

Mike Reynolds4

New member
Apr 30, 2018
1
0
0
I am trying to get a tutorial on game development working and I am receiving the error above and not sure what is going on.

This is the code:

((GameBoard)findViewById(R.id.the_canvas)).getSpritelWidth();

the error is unexpected cast to GameBoard: layout tag was ImageView


in looking at the code, GameBoard extends ImageView and the drawable tag for the_canvas is ImageView.

public class GameBoard extends ImageView {

<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="20dip"
android:id="@+id/the_canvas"/>

Any idea what is happening?
 

Trending Posts

Forum statistics

Threads
956,238
Messages
6,967,079
Members
3,163,489
Latest member
JonC