title: Android: Fragments - java.lang.RuntimeException: Unable to instantiate activity ComponentInfo
body: <p>I'm trying to use fragments to create a simple, persistent navigation bar. The problem is I'm getting the following Error output.</p>
  
  <pre><code>05-23 14:58:02.861: E/AndroidRuntime(882): FATAL EXCEPTION: main
  05-23 14:58:02.861: E/AndroidRuntime(882): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo    {org.childrensmuseum.visittcmindy/org.childrensmuseum.visittcmindy.MainActivity}: java.lang.ClassNotFoundException: org.childrensmuseum.visittcmindy.MainActivity
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread.access$600(ActivityThread.java:122)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.os.Looper.loop(Looper.java:137)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread.main(ActivityThread.java:4340)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at dalvik.system.NativeStart.main(Native Method)
  05-23 14:58:02.861: E/AndroidRuntime(882): Caused by: java.lang.ClassNotFoundException: org.childrensmuseum.visittcmindy.MainActivity
  05-23 14:58:02.861: E/AndroidRuntime(882):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
  05-23 14:58:02.861: E/AndroidRuntime(882):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
  05-23 14:58:02.861: E/AndroidRuntime(882):  ... 11 more
  </code></pre>
  
  <p>My main activity looks like this:</p>
  
  <pre><code>package org.childrensmuseum.visittcmindy;
  
  import android.graphics.Color;
  import android.graphics.PixelFormat;
  import android.os.Bundle;
  import android.support.v4.app.FragmentActivity;
  import android.view.Menu;
  import android.widget.ImageButton;
  
  public class MainActivity extends FragmentActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      getWindow().setFormat(PixelFormat.RGBA_8888);
      findViewById(R.id.NavigationBar).getBackground().setDither(true);
      ImageButton homeButton = (ImageButton) findViewById(R.id.home_button);
      homeButton.setColorFilter(Color.argb(255, 90, 179, 0));
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.activity_main, menu);
      return true;
  }
  
  
  }
  </code></pre>
  
  <p>My Fragment looks like this:</p>
  
  <pre><code>package org.childrensmuseum.visittcmindy;
  
  import android.os.Bundle;
  import android.support.v4.app.Fragment;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  
  public class MainNavigation extends Fragment{
  
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
      return inflater.inflate(R.layout.navigation_main, container, false);
  }
  }
  </code></pre>
  
  <p>Lastly my main activity xml file looks like this:</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;ImageView 
      android:id="@+id/HomeBackground"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:contentDescription="@string/homescreen_desc"
      android:src="@drawable/homescreen"
      android:scaleType="centerCrop"
      /&gt;
  &lt;fragment android:name="org.childrensmuseum.visittcmindy.MainNavigation"
      android:id="@+id/NavigationBar"
      android:layout_gravity="bottom" /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>What am I missing?</p>