我已经完成了最后一部分(开始另一个活动)的所有步骤,它确实在第二个活动上显示了消息,但是当我单击向上按钮时,它会抛出下面的异常,我已经包含了 LogCat 中的整个错误部分窗户。
我尝试在网上搜索“ bad parentActivityName ”或“没有指定父活动名称”,但找不到任何明确的信息或与培训相关的任何内容。
E/Activity(17099): getParentActivityIntent: bad parentActivityName 'com.example.myfirstapp.MainActivity' in manifest
E/NavUtils(17099): getParentActivityIntent: bad parentActivityName 'com.example.myfirstapp.MainActivity' in manifest
D/AndroidRuntime(17099): Shutting down VM
E/AndroidRuntime(17099): FATAL EXCEPTION: main
E/AndroidRuntime(17099): java.lang.IllegalArgumentException: Activity DisplayMessageActivity
does not have a parent activity name specified. (Did you forget to add the
android.support.PARENT_ACTIVITY <meta-data> element in your manifest?)
E/AndroidRuntime(17099): at android.support.v4.app.NavUtils.navigateUpFromSameTask(NavUtils.java:177)
E/AndroidRuntime(17099): at com.example.myfirstname.DisplayMessageActivity.onOptionsItemSelected(DisplayMessageActivity.java:55)
E/AndroidRuntime(17099): at android.app.Activity.onMenuItemSelected(Activity.java:2548)
E/AndroidRuntime(17099): at com.android.internal.widget.ActionBarView$3.onClick(ActionBarView.java:167)
E/AndroidRuntime(17099): at android.view.View.performClick(View.java:4204)
E/AndroidRuntime(17099): at android.view.View$PerformClick.run(View.java:17355)
E/AndroidRuntime(17099): at android.os.Handler.handleCallback(Handler.java:725)
E/AndroidRuntime(17099): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(17099): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(17099): at android.app.ActivityThread.main(ActivityThread.java:5041)
E/AndroidRuntime(17099): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(17099): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(17099): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
E/AndroidRuntime(17099): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
E/AndroidRuntime(17099): at dalvik.system.NativeStart.main(Native Method)