title: Android onclick Login Crash
body: <p>I'm new Android developer - I'm trying to implement an <code>onClickListener</code>, so that when a button is clicked, it checks the text entered, and if it's right, starts a new activity. </p>
  
  <p>There are no errors displayed in either the XML file or class. But when the text fields matchs the code, the application crashes. [ In LogCat, in line: <code>startActivity(intent)</code>; ]</p>
  
  <p>If you can that, that would be appreciated, thanks.</p>
  
  <pre><code>public class HomeMain extends Activity implements OnClickListener {
      EditText editTextUN;
      EditText editTextPW;
      Button buttonlogin;
      Button buttoncancel;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_home_main);
  
          editTextUN = (EditText) findViewById(R.id.editTextUN);
          editTextPW = (EditText) findViewById(R.id.editTextPW);
          buttonlogin = (Button) findViewById(R.id.buttonlogin);
          buttoncancel = (Button) findViewById(R.id.buttoncancel);
  
          buttonlogin.setOnClickListener(this);
          buttoncancel.setOnClickListener(this);
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; 
          // this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.home_main, menu);
          return true;
      }
  
      @Override
      public void onClick(View v) {
          String un=editTextUN.getText().toString();
          String pw=editTextPW.getText().toString();
              switch (v.getId()) {
              case R.id.buttonlogin:
                  if(un.equals("techie") &amp;&amp; pw.equals("techie")) {
                      Intent x=new Intent(this,Menu.class);
                      startActivity(x);
                  }
                  break;
              case R.id.buttoncancel:
                  editTextUN.setText("");
                  editTextPW.setText("");
                  break;
              default: break;
              }
      }
  }
  </code></pre>
  
  <p>This is my other class that the onClick should go to. (Nothing really happens in here yet. For now its just another screen)</p>
  
  <pre><code>public class Menu extends Activity implements OnClickListener {
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu);
      }
      public void onClick(View v) {}
  }
  </code></pre>
  
  <p>And also, the LogCat error:</p>
  
  <pre><code>E/AndroidRuntime(1702): FATAL EXCEPTION: main
  E/AndroidRuntime(1702): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.appname.appname/android.view.Menu}; have you declared this activity in your AndroidManifest.xml?
  E/AndroidRuntime(1702):     at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1628)
  E/AndroidRuntime(1702):     at android.app.Instrumentation.execStartActivity(Instrumentation.java:1424)
  E/AndroidRuntime(1702):     at android.app.Activity.startActivityForResult(Activity.java:3390)
  E/AndroidRuntime(1702):     at android.app.Activity.startActivityForResult(Activity.java:3351)
  E/AndroidRuntime(1702):     at android.app.Activity.startActivity(Activity.java:3587)
  E/AndroidRuntime(1702):     at android.app.Activity.startActivity(Activity.java:3555)
  E/AndroidRuntime(1702):     at com.appname.appname.HomeMain.onClick(HomeMain.java:52)
  E/AndroidRuntime(1702):     at android.view.View.performClick(View.java:4240)
  E/AndroidRuntime(1702):     at android.view.View$PerformClick.run(View.java:17721)
  E/AndroidRuntime(1702):     at android.os.Handler.handleCallback(Handler.java:730)
  E/AndroidRuntime(1702):     at android.os.Handler.dispatchMessage(Handler.java:92)
  E/AndroidRuntime(1702):     at android.os.Looper.loop(Looper.java:137)
  E/AndroidRuntime(1702):     at android.app.ActivityThread.main(ActivityThread.java:5103)
  E/AndroidRuntime(1702):     at java.lang.reflect.Method.invokeNative(Native Method)
  E/AndroidRuntime(1702):     at java.lang.reflect.Method.invoke(Method.java:525)
  </code></pre>
  
  <p>And this is the Manifest below:</p>
  
  <pre><code>&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.appname.appname"
  android:versionCode="1"
  android:versionName="1.0" &gt;
  
  &lt;uses-sdk
      android:minSdkVersion="17"
      android:targetSdkVersion="18" /&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="com.appname.appname.HomeMain"
          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="com.appname.appname.Admin"
          android:label="@string/title_activity_create" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="com.appname.appname.MainActivity"
          android:label="@string/activity_main" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="com.appname.appname.NewJob"
          android:label="@string/add_new_job" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="com.appname.appname.EditJob"
          android:label="@string/edit_job" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="com.appname.appname.Scroll"
          android:label="@string/title_activity_scroll" &gt;
      &lt;/activity&gt;
      &lt;activity
          android:name="com.appname.appname.AddNewJob"
          android:label="@string/title_activity_add_new_job" &gt;
      &lt;/activity&gt;
  
      &lt;activity
          android:name="com.appname.appname.Home"
          android:label="@string/title_activity_home" &gt;
      &lt;/activity&gt;
  
      &lt;activity 
          android:name="com.appname.appname.HomeMain"
          android:label="@string/title_activity_home_main" &gt;
  
      &lt;/activity&gt;
  
      &lt;activity
          android:name="com.appname.appname.Menu"
          android:label="@string/title_activity_menu" &gt;
      &lt;/activity&gt;
  
  &lt;/application&gt;
  </code></pre>
  
  <p></p>