4

I'm working on the Tabs example from Google Android Developers site (http://developer.android.com/resources/tutorials/views/hello-tabwidget.html) but I'm stuck in step 2.

At the very end of step 2 says "Duplicate this for each of the three activities, and add the corresponding tags to the Android Manifest file"

What exactly do I have to add to the AndroidManifest.xml?

Thanks

esausilva
  • 1,964
  • 4
  • 26
  • 54

4 Answers4

4

This is how your Manifest file should be:

    <activity android:name=".ArtistsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <activity android:name=".SongsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

    <activity android:name=".AlbumsActivity"
              android:label="@string/app_name" 
              android:theme="@android:style/Theme.NoTitleBar">
    </activity>

</application>

This will work for sure!!

Pa1
  • 192
  • 2
  • 10
4

just add every activity AndroidManifest.xml

main activity use:
<activity android:name=".Tabs">
<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
another activity use:
 <activity android:name=".Tab1">
     <intent-filter>
              <action android:name="android.intent.action.EDIT"/>
              <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
     </activity>
Narasimha
  • 3,802
  • 11
  • 55
  • 83
  • Thanks, this worked for me! I did not understand from the tutorial that I needed to add the Tabs activity as MAIN and LAUNCHER. So every time, the app installed and nothing opened. You saved me a lot of frustration, thanks! – Matt Robertson Nov 01 '11 at 05:04
2

Basically you have register each activities in AndroidManifest.xml like this

<activity android:name=".YourActivityName"/>
Shashank_Itmaster
  • 2,465
  • 5
  • 30
  • 56
1

You have to add the corresponding <activity> tags for each one of the three activities. The AndroidManifest.xml file describes the components of the application (amongst other things like permissions and API level support).

In this example you have to add three definitions:

<activity android:name=".ArtistsActivity"/>
<activity android:name=".AlbumsActivity"/>
<activity android:name=".SongsActivity"/>
mgv
  • 8,384
  • 3
  • 43
  • 47