Fatal exception: java.lang.ClassCastException: android.widget.TextView
<p>My problem is, that i like to run this application on the emulator but the applications always gets a force close and all these errors. Eclipse isn't showing me any warning. I'm new at java programming and I don't have a clue what the problem is here. Also because I got this code from a video tutorial and there was no problem. </p>

<p>I already searched for some of the errors but it didn't help for me.</p>

<p>I hope someone of you like to help me.</p>

<p>Thank you</p>

<p>reflexx03</p>

<p>HelloAndroidActivity.java</p>

<pre><code>package ch.reflexx03.HelloAndroid;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

public class HelloAndroidActivity extends Activity implements OnClickListener {

    private TextView textViewHalloAndroid;
    private EditText editTextVornameNachname;
    private Button buttonSagHallo;
    private Button buttonToast;
    private Button buttonWillkommen;
    private ImageView imageViewHalloAndroidKopf;




    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.halloandroidlayout);


        textViewHalloAndroid = (TextView) this.findViewById(R.id.textViewHalloAndroid);

        editTextVornameNachname  = (EditText) this.findViewById(R.id.editTextVornameNachname);
        buttonSagHallo  = (Button) this.findViewById(R.id.buttonSagHallo);
        buttonToast  = (Button) this.findViewById(R.id.textViewHalloAndroid);
        buttonWillkommen = (Button) this.findViewById(R.id.buttonToast);
        imageViewHalloAndroidKopf  = (ImageView) this.findViewById(R.id.imageViewHalloAndroidKopf);

        buttonToast.setOnClickListener(this);
        buttonSagHallo.setOnClickListener(this);
        buttonWillkommen.setOnClickListener(this);

    }

    public void onClick(View v) {


        //alternative mit if --&gt; ABER Vorteil hier: bsp auch über menueintrag auswählbar
        switch (v.getId()) {
        case R.id.buttonToast:
            toastAussprechen();
            break;
        case R.id.buttonSagHallo:
            //TODO Button Sag Hallo implementieren
            break;
        case R.id.buttonWillkommen:
            //TODO Button Willkommen implementieren
            break;

        }
    }




    private void toastAussprechen() {

        CharSequence vornameName = this.editTextVornameNachname.getText();
        Toast.makeText(this, "Ein Toast auf " +vornameName, Toast.LENGTH_LONG).show();

    }
}
</code></pre>

<p>halloandroidlayout.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" &gt;




    &lt;ImageView
        android:id="@+id/imageViewHalloAndroidKopf"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="center"
        android:src="@drawable/ic_launcher" /&gt;

    &lt;TextView
        android:id="@+id/textViewHalloAndroid"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:text="@string/halloandroid"
        android:textAppearance="?android:attr/textAppearanceLarge" /&gt;

    &lt;EditText
        android:id="@+id/editTextVornameNachname"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:ems="10"
        android:inputType="textPersonName" &gt;

        &lt;requestFocus /&gt;
    &lt;/EditText&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content" &gt;

        &lt;Button
            android:id="@+id/buttonSagHallo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/saghallo" /&gt;

        &lt;Button
            android:id="@+id/buttonToast"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/eintoast" /&gt;




        &lt;Button
            android:id="@+id/buttonWillkommen"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="@string/willkommen" /&gt;

    &lt;/LinearLayout&gt;

&lt;/LinearLayout&gt;
</code></pre>

<p>errors:</p>

<pre><code>04-03 01:25:43.055: E/AndroidRuntime(20424): FATAL EXCEPTION: main
04-03 01:25:43.055: E/AndroidRuntime(20424): java.lang.RuntimeException: Unable to start activity ComponentInfo{ch.reflexx03.HelloAndroid/ch.reflexx03.HelloAndroid.HelloAndroidActivity}: java.lang.ClassCastException: android.widget.TextView
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread.access$1500(ActivityThread.java:117)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.os.Handler.dispatchMessage(Handler.java:99)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.os.Looper.loop(Looper.java:130)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread.main(ActivityThread.java:3691)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at java.lang.reflect.Method.invokeNative(Native Method)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at java.lang.reflect.Method.invoke(Method.java:507)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:907)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:665)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at dalvik.system.NativeStart.main(Native Method)
04-03 01:25:43.055: E/AndroidRuntime(20424): Caused by: java.lang.ClassCastException: android.widget.TextView
04-03 01:25:43.055: E/AndroidRuntime(20424):    at ch.reflexx03.HelloAndroid.HelloAndroidActivity.onCreate(HelloAndroidActivity.java:36)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-03 01:25:43.055: E/AndroidRuntime(20424):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1615)
04-03 01:25:43.055: E/AndroidRuntime(20424):    ... 11 more
</code></pre>
