Stuck on why my android app wont work?
<p>Ok, so I am working on an app which will do the following:</p>

<ol>
<li>Allow the first user "Sam" to type his/her message in the editText field.</li>
<li>Press the "Alex" button at the bottom of the screen to start the new activity ActivityAlex</li>
<li>Allow user "Alex" to edit the editText field.</li>
<li>Press the "Sam" button at the bottom of the screen to restart the activity MainActivity</li>
</ol>

<p>So far, I think I have most of the work done but I'm getting stuck on how to fix the program so it will do what I want it to do.</p>

<p>Here is my <a href="http://imgur.com/DZkFT" rel="nofollow">logcat</a> </p>

<p>Here is my MainActivity:</p>

<pre><code>package com.chatfriends;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.*;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }

    private Button alexButton; //initialize the buttons for "alex" and "sam"

    public void initialize(){

        alexButton = (Button) findViewById(R.id.button1); // initializing the buttons by location. Also need to define the button with two states (regular and yellow)

       alexButton.setOnClickListener(new OnClickListener(){
        public void onClick(View arg0){
        alexbutton(arg0);
        }

        public void alexbutton(View v) {
            Intent intent = new Intent(MainActivity.this, ActivityAlex.class); //the intent is telling the app what you want it to do. Think about setting the intent to the buttons.
            startActivity(intent);

        }
    });
  }
}
</code></pre>

<p>Here is my ActivityAlex:</p>

<pre><code>package com.chatfriends;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class ActivityAlex extends MainActivity {

      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }


        private Button samButton; //initialize the buttons for "alex" and "sam"

        public void initialize(){

            samButton = (Button) findViewById(R.id.button2); // initializing the buttons by location. Also need to define the button with two states (regular and yellow)

        samButton.setOnClickListener(new OnClickListener(){
            public void onClick(View arg0){
            samButton(arg0);
            }

            public void samButton(View v) {
                Intent intent = new Intent(ActivityAlex.this, MainActivity.class); //the intent is telling the app what you want it to do. Think about setting the intent to the buttons.
                startActivity(intent);

            }
        });
    }
}
</code></pre>

<p>Here is my Manifest code:</p>

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

    &lt;uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="16" tools:ignore="MissingPrefix"/&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=".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=".ActivityAlex" /&gt;
    &lt;/application&gt;

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

<p>Here are the xml layout files:
activity_main:</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=".MainActivity" &gt;

        &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="@string/userName1"
        android:textAppearance="?android:attr/textAppearanceLarge" /&gt;

    &lt;EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView1"
        android:ems="10"
        android:inputType="textMultiLine" &gt;

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

    &lt;Button
        android:id="@+id/button1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="26dp"
        android:layout_toRightOf="@+id/textView1"
        android:text="@string/button1"
        android:onClick="startalexbutton" /&gt;

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

<p>activityalex.xml</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&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=".ActivityAlex" &gt;

    &lt;TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:text="@string/userName2"
        android:textAppearance="?android:attr/textAppearanceLarge" /&gt;

    &lt;EditText
        android:id="@+id/editText1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_below="@+id/textView1"
        android:ems="10"
        android:inputType="textMultiLine" &gt;
    &lt;/EditText&gt;


    &lt;Button
        android:id="@+id/button2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_marginBottom="26dp"
        android:layout_marginRight="20dp"
        android:layout_toRightOf="@+id/textView1"
        android:text="@string/button2"
        android:onClick="startMainActivity" /&gt;

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

<p>Thanks in advance!</p>
