android - How do I specify a .Preference activity in the manifest.xml of a library activity -
i modeled code after tictactoe sample application, setup have application shell starts common activity in separate eclipse project flagged shared library ( properties->isalibrary ). have add the library calling activity's properties. invoke shared library code follows:
private void startgame() { intent = new intent( this, calendar.class ); startactivityforresult( i, start_application ); }
my androidmanifest calling activity follows:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.calendar" android:screenorientation="portrait" android:versioncode="1" android:versionname="1.0"> <application android:label="@string/app_name" android:debuggable="true" android:icon="@drawable/icon"> <activity android:name=".mainactivity" android:screenorientation="portrait" android:label="@string/app_name" android:configchanges="keyboardhidden|orientation"> <intent-filter> <action android:name="android.intent.action.main" /> <category android:name="android.intent.category.launcher" /> </intent-filter> </activity> <!-- defined in calendarlib. right need manually copy here. should merged automatically. --> <activity android:name="com.library.calendar" > </activity> <!-- <activity android:name=".preferences" android:label="@string/preftitle"--> <!-- android:screenorientation="nosensor">--> <!-- <intent-filer>--> <!-- <action android:name="com.calendar.library.preferences" />--> <!-- <catagory android:name="android.intent.catagory.preference" />--> <!-- </intent-filer>--> <!-- </activity>--> </application> <uses-sdk android:minsdkversion="4" /> <uses-permission android:name="android.permission.write_external_storage" /> <supports-screens android:anydensity="false" android:resizeable="true" android:largescreens="true" android:normalscreens="true" android:smallscreens="false" /> </manifest>
the androidmanifest shared library follows:
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.calendar.library" android:versioncode="1" android:versionname="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <!-- activity tag here not used. main project must redefine activities used libraries. later tools pick activities here , merge them automatically, it's best define activities here regular android project. --> <activity android:name="calendar" /> <activity android:name=".preferences" android:label="@string/preftitle" android:screenorientation="nosensor"> <intent-filer> <action android:name=".preferences" /> <catagory android:name="android.intent.catagory.preference" /> </intent-filer> </activity> </application> <uses-sdk android:minsdkversion="4" /> </manifest>
i define menu in shared library code's activity class , invoke follows:
case menu_settings: intent intent = new intent().setclass( this, preferences.class ); this.startactivityforresult( intent, 0 ); return true;
when click on settings start_intent_not_resolved in method execstartactivity() in instrumentation.java. looking @ intent execstartactivity trying start see that
mpackage="com.barrett.calendar" mclass="com.ifundraizer.calendar.library.preferences"
and else null, not surprisingly.
my question is:
does definition of preferences activity belong in calling activity's manifest or in shared library's manifest , should definition of class in xml?
thank time, hope clear, confusing.
read comments in shared lib manifest:
<!-- activity tag here not used. main project tictactoemain must redefine activities used libraries. later tools pick activities here , merge them automatically, it's best define activities here regular android project. -->
basically need copy activities shared library manifest application uses activities. add application androidmanifest.xml:
<activity android:name=".preferences" android:label="@string/preftitle" android:screenorientation="nosensor"> <intent-filer> <action android:name=".preferences" /> <category android:name="android.intent.category.preference" /> </intent-filer> </activity>
i see copied part, commented out. uncomment it.
Comments
Post a Comment