Activity does not have a parent activity name specified.


如上图所示:当点击红框中的箭头,调用系统方法NavUtile.navigateUpFromSameTask(this); APP直接崩溃

错误信息:

Activity SubActivity does not have a parent activity name specified. (Did you forget to add the android.support.PARENT_ACTIVITY <meta-data>  element in your manifest?)

错误原因:

SubActivity并不知道它所需要返回的父Activity是谁

修改方法:

在AndroidManifest.xml文件中添加SubActivity的<meta-data>标签,并指定父Activity,代码如下:

<activity android:name=".SubActivity"
            android:label="@string/SubActivity">
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value=".MainActivity"/>
        </activity>


你可能感兴趣的:(Activity does not have a parent activity name specified.)