my application keeps on crashing
<p>I am using Eclipse. My application selects a value from a list view in android and must display the value in another activity, but it is not happening.</p>

<p>As soon as I click on the list i get the error activity has stopped working</p>

<p>i get errors like this in all my applications</p>

<p>i made another application based on this tutorial</p>

<p><a href="http://www.vogella.com/articles/AndroidSQLite/article.html" rel="nofollow">http://www.vogella.com/articles/AndroidSQLite/article.html</a></p>

<p>My code consists of two activities:</p>

<p>MainActivity.java</p>

<pre><code>package event.scheduler;
import android.os.Bundle;    
import android.util.Log;    
import android.view.View;    
import android.app.ListActivity;    
import android.content.Intent;    
import android.widget.ArrayAdapter;    
//import android.widget.Toast;    
import android.widget.ListView;    
public class MainActivity extends ListActivity {
public final static String EXTRA_MESSAGE = "event.scheduler.MESSAGE";

@Override
    protected void onCreate(Bundle savedInstanceState) {
    try
    {
    super.onCreate(savedInstanceState);
    String[] values = new String[]{"Conatus","Horizon","Orja","Phoniex"};
    ArrayAdapter &lt;String&gt; adapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1,values);
    setListAdapter(adapter);
}
    catch(RuntimeException e){
        Log.i("sdv","dsvg");
        }
    }           

@Override   
protected void onListItemClick(ListView l, View v, int position, long id) {
     try
        {

    String item = (String)getListAdapter().getItem(position);
   Intent intent = new Intent(this,Display.class);
   intent.putExtra(EXTRA_MESSAGE,item);
   startActivity(intent);
   }

catch(RuntimeException e)
{
    Log.i("log","view");
}
}          // Toast.makeText(this, item + " selected", Toast.LENGTH_LONG).show(); 

}
</code></pre>

<p>Display.java</p>

<pre><code>     package event.scheduler;

     import android.os.Bundle;
     import android.app.Activity;
     import android.app.ListActivity;
     import android.content.Intent;
     import android.util.Log;

     import android.widget.TextView;

     public class Display extends Activity {

TextView textview;
@Override
protected void onCreate(Bundle savedInstanceState) {
    //try
    {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_display);
    Intent intent = getIntent();
    String message = intent.getStringExtra(MainActivity.EXTRA_MESSAGE);
    textview= (TextView)findViewById(R.id.your_texbox);
    textview.setTextSize(40);
    textview.setText(message);

    setContentView(textview);

    }
    //catch(RuntimeException e)
    {
    //  Log.i("sfs", "message");
        }
    }
</code></pre>

<p>}</p>

<p>my xml files are</p>

<p>activity_display.xml</p>

<pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".Display" &gt;

&lt;TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_centerVertical="true"
    android:text="@string/hello_world" /&gt;
</code></pre>

<p></p>

<p>activity_main.xml</p>

<pre><code>               &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/LinearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity" &gt;

&lt;ListView
    android:id="@+id/mylist"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    &gt;
&lt;/ListView&gt;
</code></pre>

<p></p>

<p>my manifest file is</p>

<pre><code>               &lt;?xml version="1.0" encoding="utf-8"?&gt;
               &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="event.scheduler"
android:versionCode="1"
android:versionName="1.0" &gt;

&lt;uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="16" /&gt;

&lt;application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" &gt;
    &lt;activity
        android:name="event.scheduler.MainActivity"
        android:label="@string/app_name" &gt;
        &lt;intent-filter&gt;
            &lt;action android:name="android.intent.action.MAIN" /&gt;

            &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
        &lt;/intent-filter&gt;
    &lt;/activity&gt;
    &lt;activity
        android:name="event.scheduler.Display"
        android:label="@string/title_activity_display" &gt;
    &lt;/activity&gt;
&lt;/application&gt;
</code></pre>

<p></p>

<p>my logcat is </p>

<pre><code>01-20 14:49:01.171: D/AndroidRuntime(1278): Shutting down VM
01-20 14:49:01.181: W/dalvikvm(1278): threadid=1: thread exiting with uncaught exception (group=0x40a70930)
01-20 14:49:01.301: E/AndroidRuntime(1278): FATAL EXCEPTION: main
01-20 14:49:01.301: E/AndroidRuntime(1278): java.lang.RuntimeException: Unable to start activity ComponentInfo{event.scheduler/event.scheduler.Display}: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2180)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread.access$600(ActivityThread.java:141)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.os.Handler.dispatchMessage(Handler.java:99)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.os.Looper.loop(Looper.java:137)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread.main(ActivityThread.java:5039)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at java.lang.reflect.Method.invokeNative(Native Method)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at java.lang.reflect.Method.invoke(Method.java:511)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at dalvik.system.NativeStart.main(Native Method)
01-20 14:49:01.301: E/AndroidRuntime(1278): Caused by: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.view.ViewGroup.addViewInner(ViewGroup.java:3339)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.view.ViewGroup.addView(ViewGroup.java:3210)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.view.ViewGroup.addView(ViewGroup.java:3186)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:289)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:279)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.Activity.setContentView(Activity.java:1901)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at event.scheduler.Display.onCreate(Display.java:26)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.Activity.performCreate(Activity.java:5104)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
01-20 14:49:01.301: E/AndroidRuntime(1278):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
01-20 14:49:01.301: E/AndroidRuntime(1278):     ... 11 more
</code></pre>
