1. Mike Reynolds4's Avatar
    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?
    04-30-2018 09:43 PM

Similar Threads

  1. how to convert windows nextbook 10 to android
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 05-01-2018, 10:59 AM
  2. Why does my phone constantly say " Network error, please try again?
    By Android Central Question in forum Ask a Question
    Replies: 0
    Last Post: 04-30-2018, 06:24 PM
  3. I take a picture ...it stays in camera file instead of going to gallery
    By Android Central Question in forum Ask a Question
    Replies: 2
    Last Post: 04-30-2018, 05:51 PM
  4. unexpected cast to GameBoard: Layout Tag was ImageView
    By Android Central Question in forum Ask a Question
    Replies: 1
    Last Post: 04-30-2018, 05:50 PM
  5. intermittently have to dismiss alarms twice
    By lhh995 in forum Ask a Question
    Replies: 0
    Last Post: 04-30-2018, 05:40 PM
LINK TO POST COPIED TO CLIPBOARD