aboutsummaryrefslogtreecommitdiff
path: root/mobileapp/src/smoots/udesign/main/UDesignTabWidget.java
blob: 35425c1d41326192f54bd72d948a0683be415286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package smoots.udesign.main;

import smoots.udesign.canvas.VirtualCanvasActivity;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class UDesignTabWidget extends TabActivity {
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.main);

		Resources res = getResources(); // Resource object to get Drawables
		TabHost tabHost = getTabHost(); // The activity TabHost
		TabHost.TabSpec spec; // Reusable TabSpec for each tab
		Intent intent; // Reusable Intent for each tab

		// Create an Intent to launch an Activity for the tab (to be reused)
		intent = new Intent().setClass(this, VirtualCanvasActivity.class);
		// Initialize a TabSpec for each tab and add it to the TabHost
		spec = tabHost.newTabSpec("canvas").setIndicator("Canvas",
				res.getDrawable(R.drawable.ic_tab_canvas)).setContent(intent);
		tabHost.addTab(spec);

		// Do the same for the other tabs
		/*
		 * intent = new Intent().setClass(this, ColorActivity.class); spec =
		 * tabHost.newTabSpec("color").setIndicator("Color",
		 * res.getDrawable(R.drawable.ic_tab_color)) .setContent(intent);
		 * tabHost.addTab(spec);
		 */

		intent = new Intent().setClass(this, InteractionsActivity.class);
		spec = tabHost.newTabSpec("interactions").setIndicator("Interactions",
				res.getDrawable(R.drawable.ic_tab_interactions)).setContent(
				intent);
		tabHost.addTab(spec);

		tabHost.setCurrentTab(0);
	}
}