unexpected cast to GameBoard: Layout Tag was ImageView

  • Thread starter Thread starter Android Central Question
  • Start date Start date
A

Android Central Question

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

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"/>

Suggestions?
 

Trending Posts

Forum statistics

Threads
957,606
Messages
6,973,718
Members
3,163,864
Latest member
pakeezahere8