AndroidManifest.xml中声明不同包中的Activity
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tencent"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".QCalendarActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DayDetailActivity" android:theme="@android:style/Theme.Translucent" />
<activity android:name="com.android.tencent.agenda.InputAgendaItemActivity"/>
<activity android:name="com.android.tencent.agenda.DisplayAgendaListActivity"/>
<activity android:name="com.android.tencent.agenda.DisplayAgendaItemActivity"/>
</application>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.tencent"
android:versionCode="1"
android:versionName="1.0">
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".QCalendarActivity"
android:label="@string/app_name" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".DayDetailActivity" android:theme="@android:style/Theme.Translucent" />
<activity android:name="com.android.tencent.agenda.InputAgendaItemActivity"/>
<activity android:name="com.android.tencent.agenda.DisplayAgendaListActivity"/>
<activity android:name="com.android.tencent.agenda.DisplayAgendaItemActivity"/>
</application>
</manifest>
主包:com.android.tencent
次包:com.android.tencent.agenda
QCalendarActivity和DayDetailActivity同在主包中,InputAgendaItemActivity,DisplayAgendaListActivity和DisplayAgendaItemActivity在次包中,点击DayDetailActivity中的一个按钮启动次包中的活动。
实质:在AndroidManifest.xml中声明Activity时,指定完整包路经即可。