0

我正在使用 2 个菜单项,第一个菜单项发送全局问候语和第二项设置,每当我单击设置菜单项时,我总是收到以下消息:

不幸的是应用程序已停止

Logcat 说:

01-03 16:20:38.102: E/AndroidRuntime(953): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.january.floogoo/android.media.audiofx.BassBoost$Settings}; have you declared this activity in your AndroidManifest.xml?
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1618)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1417)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivityFromChild(Activity.java:3843)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivityFromChild(Activity.java:3819)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivityForResult(Activity.java:3395)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivityForResult(Activity.java:3331)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivity(Activity.java:3566)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.startActivity(Activity.java:3534)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.january.floogoo.ContactTab.onOptionsItemSelected(ContactTab.java:90)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.Activity.onMenuItemSelected(Activity.java:2548)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.policy.impl.PhoneWindow.onMenuItemSelected(PhoneWindow.java:980)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:735)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:149)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:874)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.view.menu.ListMenuPresenter.onItemClick(ListMenuPresenter.java:166)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.widget.AdapterView.performItemClick(AdapterView.java:298)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.widget.AbsListView.performItemClick(AbsListView.java:1100)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.widget.AbsListView$PerformClick.run(AbsListView.java:2749)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.widget.AbsListView$1.run(AbsListView.java:3423)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.os.Handler.handleCallback(Handler.java:725)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.os.Handler.dispatchMessage(Handler.java:92)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.os.Looper.loop(Looper.java:137)
01-03 16:20:38.102: E/AndroidRuntime(953):  at android.app.ActivityThread.main(ActivityThread.java:5039)
01-03 16:20:38.102: E/AndroidRuntime(953):  at java.lang.reflect.Method.invokeNative(Native Method)
01-03 16:20:38.102: E/AndroidRuntime(953):  at java.lang.reflect.Method.invoke(Method.java:511)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
01-03 16:20:38.102: E/AndroidRuntime(953):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
01-03 16:20:38.102: E/AndroidRuntime(953):  at dalvik.system.NativeStart.main(Native Method)

清单.xml

  <activity
        android:name="com.january.floogoo.Main"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity android:name=".ContactTab"></activity>
    <activity android:name=".MonthTab"></activity>
    <activity android:name=".WeekTab"></activity>
    <activity android:name=".PersonalGreeting"></activity>
    <activity android:name=".GlobalGreeting"></activity>
    <activity android:name=".AlertPage"></activity>
    <activity android:name=".Settings"></activity>
    <activity android:name=".Alert2"></activity>
4

2 回答 2

0

您的清单中已经有Setting活动,但我认为包名称错误。尝试使用完整的包名来设置它,比如com.january.floogoo.Settings.

于 2013-01-03T11:09:05.980 回答
0

在 Manifest 中声明设置活动:

 <activity android:name="com.january.floogoo.Settings" />

并使用完整的包名称启动设置活动,因为您已经导入了另一个具有相同活动名称的包

 Intent intentd=new Intent(Current_Activity.this,
                              com.january.floogoo.Settings.class);
 startActivity(intentd);
于 2013-01-03T11:09:22.397 回答