当我尝试返回到MainActivity
时,出现在操作栏图标旁边的默认后退按钮会崩溃。从MainActivity
调用DisplayMessageActivity
后,我点击默认后退按钮,应用会崩溃。
日志显示消息:
E/AndroidRuntime(24509): 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?)
这是我的清单:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.assemblyx.playzone"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="11"
android:targetSdkVersion="18" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="net.assemblyx.playzone.MainActivity"
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="net.assemblyx.playzone.DisplayMessageActivity"
android:label="@string/title_activity_display_message"
android:parentActivityName="net.assemblyx.playZone.MainActivity" >
<meta-data
android:name="android.support.PARENT_ACTIVITY"
android:value="net.assemblyx.playZone.MainActivity" />
</activity>
</application>