【发布时间】:2011-07-16 14:51:11
【问题描述】:
我这几天遇到这个问题。我的项目中有两个包。从我的家(在家庭包内)活动中,我将使用按钮 onClickListener 方法调用我的个人资料活动(在个人资料包内)。这是代码
private OnClickListener bProfileListener = new OnClickListener() {
public void onClick(View v) {
Toast.makeText(getApplicationContext(),
" You are heading to your Profile page", Toast.LENGTH_SHORT).show();
Intent intent = new Intent(v.getContext(), Profile.class);
startActivityForResult(intent, 0);
}
}; }
这是我的清单文件。首先,我像这样定义包名称 package="com.and.profile"。
<application android:label="@string/app_name"
android:icon="@drawable/icon">
<activity android:name=".home.Home"
android:launchMode="singleTask"
android:stateNotNeeded="true"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".profile.Profile"
android:label="@string/app_profile"
android:icon="@drawable/icon"
android:theme="@android:style/Theme.NoTitleBar">
</activity>
<activity android:name=".profile.CustomListViewDB"
android:label="@string/app_profile"
android:icon="@drawable/icon">
</activity>
</application>
当我运行这个方法时,我得到了这个主要错误...... 错误/AndroidRuntime(791): android.content.ActivityNotFoundException: 找不到明确的活动类 {com.and.profile.Profile};您是否在 AndroidManifest.xml 中声明了此活动?
谁能告诉我该怎么做。我错过了什么吗?非常感谢。
【问题讨论】:
标签: android android-activity android-manifest