Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android:parentActivityName doesn't work although android-support-v4.jar is included

Tags:

android

i've included the android-support-v4.jar library to use "android:parentActivityName="com.myApp.example.MainActivity". It's included in "Android" Dependencies" and "Referenced Libraries", but it still doesn't work ->

error: No resource identifier found for attribute 'parentActivityName' in package 'android'

Any suggestions?

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.myApp.example"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <uses-feature android:name="android.hardware.location.network" />
    <uses-feature android:name="android.hardware.location.gps" />
    <uses-feature android:name="android.hardware.wifi" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <activity
            android:name="com.myApp.example.MainActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/app_name"
            android:uiOptions="splitActionBarWhenNarrow" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <action android:name="android.intent.action.SEARCH" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <activity
            android:name="com.myApp.example.AboutUsActivity"
            android:configChanges="keyboardHidden|orientation|screenSize"
            android:label="@string/AboutUs" 
            android:parentActivityName="com.myApp.example.MainActivity" >
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.myApp.example.MainActivity" />
        </activity>

    </application>

</manifest>
like image 801
Kody Avatar asked Feb 15 '13 08:02

Kody


1 Answers

As @iargin said

android:parentActivityName is introduced in API 16

It's true, and building against api level 16 works fine, however from official documentation the equivalent is using meta-data tag

    <activity
        android:name="com.dwaik.actionbar.LocationFound"
        android:label="@string/loc">
        <meta-data
            android:name="android.support.PARENT_ACTIVITY"
            android:value="com.dwaik.actionbar.MainActivity" />
    </activity>

and it works on api level 15

like image 185
Ahmad Dwaik 'Warlock' Avatar answered Oct 13 '22 04:10

Ahmad Dwaik 'Warlock'