Tab Layout example from Android Dev site
I'm trying to do this tab view example from Android Examples, it works fine but I don't see the text (This is the ArtistsTab) in each tab that is set using the TextView. Not sure what I'm doing wrong. Below are the main contents of my manifest file
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".HelloTabWidget"
android:theme="@android:style/Theme.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<categ开发者_如何学编程ory android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".ArtistsActivity"></activity>
<activity android:name=".AlbumsActivity" ></activity>
<activity android:name=".SongsActivity"></activity>
</application>
Below is the content of OnCreate() method of the ArtistsActivity class
public void OnCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
TextView textView = new TextView(this);
textView.setText("Artists Tab");
setContentView(textView);
}
Thanks
I would guess your Activity doesn't even get called... try adding the following lines to your manifest file:
<activity android:name=".ArtistsActivity">
<intent-filter>
<action android:name="yourpackage.ArtistsActivity" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Replace "yourpackage" with the name of your package and do the same with the corresponding action name within your AlbumsActivity
and SongsActivity
.
More information on Intents and Intent Filters
精彩评论