【发布时间】:2014-02-05 06:51:24
【问题描述】:
我正在使用选项菜单的开关盒。但我得到了一些错误。我已经检查了 logcat 也说
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=com.app1.ABOUT }
下面给出了我在 java 类中编写的一小段代码。
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.aboutus:
Intent i = new Intent("com.app1.ABOUT");
startActivity(i);
break;
case R.id.preferences:
Intent s = new Intent("com.app1.PREFS");
startActivity(s);
break;
case R.id.exit:
finish();
break;
}
return false;
}
android manifest的代码如下。
<activity
android:name="com.app1.Aboutus"
android:label="@string/app_name"
android:theme="@android:style/Theme.Dialog" >
<intent-filter>
<action android:name="android.intent.action.ABOUT" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
我是否从我的 java 类中以正确的方式裁判清单?
【问题讨论】:
-
将
com.app1.PREFS和com.app1.ABOUT名称作为活动添加到清单文件并使用(context , class)更改意图构造函数
标签: android android-intent android-manifest