title: How do I specify a .Preference activity in the manifest.xml of a library activity
body: <p>I modeled my code after the TicTacToe sample application, so my setup is that I have an Application which is basically a shell that starts a common Activity which is in a separate eclipse project flagged as a shared library ( properties->IsALibrary ). I have add the the library to the calling activity's properties. I invoke the shared library code as follows:</p>
  
  <pre><code>    private void startGame()
      {
   Intent i = new Intent( this, calendar.class );
   startActivityForResult( i, START_APPLICATION );
      }
  </code></pre>
  
  <p>my AndroidManifest for the calling activity is as follows:</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.calendar" android:screenOrientation="portrait"
   android:versionCode="1" android:versionName="1.0"&gt;
   &lt;application android:label="@string/app_name"
    android:debuggable="true" android:icon="@drawable/icon"&gt;
  
    &lt;activity android:name=".MainActivity"
     android:screenOrientation="portrait" android:label="@string/app_name"
     android:configChanges="keyboardHidden|orientation"&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;!-- This is defined in CalendarLib. Right now we need to manually copy 
              it here. Eventually it should get merged automatically. --&gt;
          &lt;activity 
              android:name="com.library.calendar" &gt;
          &lt;/activity&gt;
  
  &lt;!--  &lt;activity android:name=".Preferences" android:label="@string/prefTitle"--&gt;
  &lt;!--   android:screenOrientation="nosensor"&gt;--&gt;
  &lt;!--   &lt;intent-filer&gt;--&gt;
  &lt;!--    &lt;action android:name="com.calendar.library.Preferences" /&gt;--&gt;
  &lt;!--    &lt;catagory android:name="android.intent.catagory.PREFERENCE" /&gt;--&gt;
  &lt;!--   &lt;/intent-filer&gt;--&gt;
  &lt;!--  &lt;/activity&gt;--&gt;
  
   &lt;/application&gt;
  
   &lt;uses-sdk android:minSdkVersion="4" /&gt;
   &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
  
   &lt;supports-screens android:anyDensity="false"
    android:resizeable="true" android:largeScreens="true"
    android:normalScreens="true" android:smallScreens="false" /&gt;
  
  &lt;/manifest&gt; 
  </code></pre>
  
  <p>the AndroidManifest for the shared library is as follows:</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.calendar.library" android:versionCode="1"
   android:versionName="1.0"&gt;
   &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
    &lt;!-- The activity tag here is currently not used. The main project must 
     currently redefine the activities to be used from the libraries. However 
     later the tools will pick up the activities from here and merge them automatically, 
     so it's best to define your activities here like for any regular Android 
     project. --&gt;
    &lt;activity android:name="calendar" /&gt;
  
          &lt;activity android:name=".Preferences" android:label="@string/prefTitle"
              android:screenOrientation="nosensor"&gt;
              &lt;intent-filer&gt;
                  &lt;action android:name=".Preferences" /&gt;
                  &lt;catagory android:name="android.intent.catagory.PREFERENCE" /&gt;
              &lt;/intent-filer&gt;
          &lt;/activity&gt;
  
   &lt;/application&gt;
   &lt;uses-sdk android:minSdkVersion="4" /&gt;
  
  &lt;/manifest&gt;
  </code></pre>
  
  <p>I define my menu in the shared library code's Activity class and invoke it as follows:</p>
  
  <pre><code>case MENU_SETTINGS:
       Intent intent = new Intent().setClass( this, Preferences.class );
       this.startActivityForResult( intent, 0 );
       return true;
  </code></pre>
  
  <p>when I click on settings I get START_INTENT_NOT_RESOLVED in the method execStartActivity() in Instrumentation.java. Looking at the intent that execStartActivity is trying to start I see that</p>
  
  <pre><code>mPackage="com.barrett.calendar" 
  mClass="com.ifundraizer.calendar.library.Preferences"
  </code></pre>
  
  <p>and everything else is null, not surprisingly.</p>
  
  <p>my question is:</p>
  
  <p>Does the definition of the preferences activity belong in the calling activity's manifest or in the shared library's manifest and what should the definition of the class look like in xml?</p>
  
  <p>thank you for your time, I hope I was clear, this is very confusing.</p>