Gabriel Goudarzi
Gabriel Goudarzi

Reputation: 77

The <activity> element must be a direct child of the <application> element error

I have added my third class to my package, and I want to add it to my androidmanifest.xml file. I have added the second class easily with no problem, but I'm stuck with the third one. When do I try to add the third activity:

<uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="19" />

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.metoo.codedetective.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="com.metoo.codedetective.Etelaateomoomi">
        <activity android:name=".Factoryreset">

        </activity>

    </activity>            

</application>

</manifest>

I get The element must be a direct child of the element. What should I do? Please correct the code and post it. thanks for advance

Upvotes: 0

Views: 1334

Answers (2)

Muhammad Kashif Nazar
Muhammad Kashif Nazar

Reputation: 23875

Remove the following lines that represent an activity inside another activity.

<activity android:name=".Factoryreset">

</activity>

Upvotes: 0

EdmDroid
EdmDroid

Reputation: 1360

In

<activity android:name="com.metoo.codedetective.Etelaateomoomi">
    <activity android:name=".Factoryreset">

    </activity>

</activity>   

remove <activity android:name=".Factoryreset"> </activity> because this is an activity in an activity which is not allowed.

I think you need this:

<activity android:name="com.metoo.codedetective.Etelaateomoomi.Factoryreset">

</activity>   

Upvotes: 1

Related Questions