title: The startactivity(intent) method causes an error. Why?
body: <p>I want after a click on the OK button the MenuActivity to be shown. I have already searched on the Internet to find an answer and tried everything. I haave the activity declared in the AndroidManifest and I also tried to use Intent(this, MenuActivity.class) and also the one with the action inside but it doesn't work.</p>
  
  <p>MainActivity:</p>
  
  <pre><code>package com.jamesjohnson.chronos;
  
  import android.app.AlertDialog;
  import android.app.Activity;
  import android.content.ActivityNotFoundException;
  import android.content.DialogInterface;
  import android.content.Context;
  import android.content.Intent;
  import android.support.v7.app.ActionBarActivity;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.*;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import com.jamesjohnson.chronos.R;
  
  
  public class MainActivity extends ActionBarActivity implements OnClickListener {
  
  private static final String TAG = "MainActivity";
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      this.setTitle("Willkommen");
      Button button = (Button) findViewById(R.id.button);
      button.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.menu_main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle action bar item clicks here. The action bar will
      // automatically handle clicks on the Home/Up button, so long
      // as you specify a parent activity in AndroidManifest.xml.
      int id = item.getItemId();
  
      //noinspection SimplifiableIfStatement
      switch(id) {
          case R.id.action_mainmenu:
              startActivity(new Intent("com.jamesjohnson.chronos.MenuActivity"));
              return true;
          case R.id.action_settings:
              showMessageBox("Es gibt leider noch keine Einstellungen. Wir arbeiten daran!", true, true);
              return true;
  
      }
  
      return super.onOptionsItemSelected(item);
  }
  
  @Override
  public void onClick(View v) {
      try {
          Intent intent = new Intent(MainActivity.this, MenuActivity.class);
          Context ctx = this;
          intent.setClassName(ctx, "com.jamesjohnson.chronos.MenuActivity");
          intent.setAction("com.jamesjohnson.chronos.MenuActivity");
          if ((intent.getAction() == "com.jamesjohnson.chronos.MenuActivity") || (intent.getClass() != null)) {
              MainActivity.this.startActivity(intent);
              showMessageBox("Button has been pressed " + intent.toString(), true, true);
          }
          else {
              showMessageBox("Error : Hauptmenü ist nicht erreichbar", true, true);
          }
      }
      catch (ActivityNotFoundException an) {
          showMessageBox("Error :" + an.getMessage(), true, true);
      }
      catch (Exception e) {
          showMessageBox("Error :" + e.getMessage(), true, true);
      }
  }
  
  protected void showMessageBox(String message, boolean showOKbutton, boolean canceable) {
      AlertDialog.Builder dlgAlert = new AlertDialog.Builder(MainActivity.this);
  
      dlgAlert.setMessage(message);
      dlgAlert.setTitle("Chronos");
      if (showOKbutton) {
          dlgAlert.setPositiveButton("OK", null);
      }
      if (canceable) {
          dlgAlert.setCancelable(true);
      }
      dlgAlert.create().show();
  }
  }
  </code></pre>
  
  <p>Here's my AndroidManifest:</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.jamesjohnson.chronos"
      android:versionCode="1"
      android:versionName="1.0.1
      " &gt;
  
      &lt;application
  
          android:allowBackup="true"
          android:debuggable="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=".MenuActivity"
              android:label="@string/title_activity_menu"
              android:parentActivityName=".MainActivity" &gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="com.jamesjohnson.chronos.MenuActivity" /&gt;
  
                  &lt;category android:name="android.intent.category.DEFAULT" /&gt;
              &lt;/intent-filter&gt;
              &lt;!-- Parent activity meta-data to support 4.0 and lower --&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value="com.jamesjohnson.chronos.MainActivity" /&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>And finally here's the MenuActivity:</p>
  
  <pre><code>package com.jamesjohnson.chronos;
  
  import android.app.AlertDialog;
  import android.app.ListActivity;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemClickListener;
  import android.widget.ArrayAdapter;
  import android.widget.ListView;
  
  
  public class MenuActivity extends ListActivity {
  
      private static final String TAG = "MenuActivity";
      static final String[] ENTRIES = new String[] {"Kunden", "Projekte", "Leistungen", "Zeiten"};
      ListView listView = getListView();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          showMessageBox("Activity is beeing created", true, true);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_menu);
          this.setTitle("Hauptmenü");
          this.setListAdapter(new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_1, ENTRIES));
          listView.setOnItemClickListener(new OnItemClickListener(){
             public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) {
                 switch (position) {
                     case 0:
                         showMessageBox("Kunden", true, true);
                         break;
                     case 1:
                         showMessageBox("Projekte", true, true);
                         break;
                     case 2:
                         showMessageBox("Leistungen", true, true);
                         break;
                     case 3:
                         showMessageBox("Zeiten", true, true);
                         break;
                     default:
                         showMessageBox("Error: Undefined index", true, true);
                 }
             }
          });
      }
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.menu_menu, menu);
          return true;
      }
  
      @Override
      public boolean onOptionsItemSelected(MenuItem item) {
          // Handle action bar item clicks here. The action bar will
          // automatically handle clicks on the Home/Up button, so long
          // as you specify a parent activity in AndroidManifest.xml.
          int id = item.getItemId();
  
          //noinspection SimplifiableIfStatement
          if (id == R.id.action_settings) {
              return true;
          }
  
          return super.onOptionsItemSelected(item);
      }
  
      protected void showMessageBox(String message, boolean showOKbutton, boolean canceable) {
          AlertDialog.Builder dlgAlert = new AlertDialog.Builder(MenuActivity.this);
  
          dlgAlert.setMessage(message);
          dlgAlert.setTitle("Chronos");
          if (showOKbutton) {
              dlgAlert.setPositiveButton("OK", null);
          }
          if (canceable) {
              dlgAlert.setCancelable(true);
          }
          dlgAlert.create().show();
      }
  }
  </code></pre>
  
  <p>Unfortunately I can't show you my Logcat because it doesn't work on my computer. (I always have to export the APK to test the App).</p>
  
  <p>P.S. I am working with Android Studio 1.0.1
  ...Please HELP ME !</p>