title: layout "resource not found" exception while trying to switch to tabbed fragment activity
body: <p>I have a loginActivity with a submit button that has sendMessage() for onClick and when I try to run the application on emulator, I get caused by: resource not found which is the resource of the layout of my 2nd activity.
  Any help would be appreciated. I've tried to delete R.java and rebuild but that' doesn't help.</p>
  
  <p>loginActivity</p>
  
  <pre><code>public class Login extends Activity {
      public final static String USERNAME = "com.example.seattleivg.USERNAME";
  
      @Override
      public void onCreate(Bundle savedInstanceState){
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_login);
      }
  
      public void sendMessage(View view) {
          Intent intent = new Intent(this, TabActionBarHomeActivity.class);
          //get username from usernameText field
          //EditText editText = (EditText) findViewById(R.id.usernameText);
          //String message = editText.getText().toString();
          //key-value pair to pass between activities
          //intent.putExtra(USERNAME, message);
          startActivity(intent);
      }
  </code></pre>
  
  <p>Manifest.xml</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.example.seattleivf"
      android:versionCode="1"
      android:versionName="1.0" &gt;
  
      &lt;uses-sdk
          android:minSdkVersion="16"
          android:targetSdkVersion="17" /&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.example.seattleivf.Login"
              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.example.seattleivf.TabActionBarHomeActivity"
              android:label="@string/app_name" 
              android:parentActivityName="com.example.seattleivf.Login"&gt;
              &lt;meta-data
                  android:name="android.support.PARENT_ACTIVITY"
                  android:value="com.example.seattleivf.Login"/&gt;
          &lt;/activity&gt;
      &lt;/application&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>TabActionBarHomeActivity.java</p>
  
  <pre><code>@Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
                  setContentView(R.layout.activity_tab_action_bar_home);
          setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
  
          //Make sure we're running on HoneyComb or higher to user ActionBar APIs
          if (Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.HONEYCOMB) {
              ActionBar actionBar = getActionBar();
  
              //show the Up button in the action bar.
              actionBar.setDisplayHomeAsUpEnabled(true);
  
              actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
  
              String label1 = getResources().getString(R.string.label1);
              Tab tab = actionBar.newTab();
              tab.setText(label1);
              TabListener&lt;AndrologyHomeFragment&gt; tl = new TabListener&lt;AndrologyHomeFragment&gt;(
                      this, label1, AndrologyHomeFragment.class);
              tab.setTabListener(tl);
              actionBar.addTab(tab);
  
              String label2 = getResources().getString(R.string.label2);
              tab = actionBar.newTab();
              tab.setText(label2);
              TabListener&lt;EmbryologyHomeFragment&gt; tl2 = new TabListener&lt;EmbryologyHomeFragment&gt;(
                      this, label2, EmbryologyHomeFragment.class);
              tab.setTabListener(tl2);
              actionBar.addTab(tab);
          }
        //tried added here too
        //setContentView(R.layout.activity_tab_action_bar_home);
      }
  </code></pre>
  
  <p>activity_tab_action_bar_home.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      tools:context=".TabActionBarHomeActivity"
      android:orientation="vertical" &gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>R.java</p>
  
  <pre><code>public static final class layout {
      public static final int activity_login=0x7f030000;
      public static final int activity_tab_action_bar_home=0x7f030001;
      public static final int andrology_home=0x7f030002;
      public static final int embryology_home=0x7f030003;
  }
  </code></pre>
  
  <p><strong>Updated the LogCat files after clean project</strong></p>
  
  <pre><code>05-01 15:30:28.609: E/AndroidRuntime(710): FATAL EXCEPTION: main
  05-01 15:30:28.609: E/AndroidRuntime(710): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.seattleivf/com.example.seattleivf.TabActionBarHomeActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2059)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread.access$600(ActivityThread.java:130)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.os.Handler.dispatchMessage(Handler.java:99)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.os.Looper.loop(Looper.java:137)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread.main(ActivityThread.java:4745)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at java.lang.reflect.Method.invokeNative(Native Method)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at java.lang.reflect.Method.invoke(Method.java:511)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at dalvik.system.NativeStart.main(Native Method)
  05-01 15:30:28.609: E/AndroidRuntime(710): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030001
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.content.res.Resources.getValue(Resources.java:1013)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:2098)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.content.res.Resources.getLayout(Resources.java:852)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.view.LayoutInflater.inflate(LayoutInflater.java:352)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:256)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.Activity.setContentView(Activity.java:1867)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at com.example.seattleivf.TabActionBarHomeActivity.onCreate(TabActionBarHomeActivity.java:53)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.Activity.performCreate(Activity.java:5008)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1079)
  05-01 15:30:28.609: E/AndroidRuntime(710):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2023)
  05-01 15:30:28.609: E/AndroidRuntime(710):  ... 11 more
  </code></pre>
  
  <p>Edit
  AndrologyHomeFragment.java (EmbryologyHomeFragment.java is the same with respective xml)</p>
  
  <pre><code>public class AndrologyHomeFragment extends Fragment {
  
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState){
          return (LinearLayout) inflater.inflate(R.layout.andrology_home, container, false);
      }
  }
  </code></pre>
  
  <p>andrology_home.xml (embryology_home.xml is the same)</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/andrology_home"
      android:layout_width="match_parent"
      android:layout_height="match_parent" &gt;
  
      &lt;TextView
          android:layout_height="wrap_content"
          android:layout_width="wrap_content"
          android:text="andrology layout" /&gt;
  
  
  &lt;/LinearLayout&gt;
  </code></pre>