【发布时间】:2014-05-17 05:45:29
【问题描述】:
这里是错误,指的是我调用startActivity(Intent)的地方:
`05-17 01:40:37.918: E/AndroidRuntime(12997):android.content.ActivityNotFoundException:
Unable to find explicit activity class {/com.rhombi.Menu}; have you declared
this activity in your AndroidManifest.xml?
这是我在 com.rhombi.Intro 中使用 startActivity(Intent) 的方法:
startActivity(iMenu);
这是我之前在同一个类中声明它的方式:
public Intent iMenu = new Intent(this, Menu.class);
这是我在清单中声明所有内容的方式:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rhombi"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
<activity
android:name=".Intro"
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=".Menu"
android:label="@string/app_name"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>
我已经搜索了很多关于此的其他问题,但我似乎无法弄清楚问题所在。使我的问题与众不同的一件事是,当它告诉我它无法找到明确的活动类(“{/com.rhombi.Menu}”)时,那个小斜杠。这从未出现在我的搜索中,但我似乎做的一切都是正确的。
【问题讨论】:
-
名为
Menu的Activity拼写是否正确,是否存在于同一个包com.rhombi中? -
已在清单中注册您的活动?
-
@ДмитрийИвановичМенделеев 是的操作有
<activity android:name=".Menu" -
是的,该类以 com.rhombi.Menu 的形式存在。
-
看起来可疑的是
ComponentInfo中的包名在这里是空的:{/com.rhombi.Menu}- 只有类名。您作为Context传递给Intentctor 的this是什么?
标签: java android android-intent android-activity logcat