-
Notifications
You must be signed in to change notification settings - Fork 2
/
FindParkingTabs.java
51 lines (40 loc) · 1.72 KB
/
FindParkingTabs.java
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
44
45
46
47
48
49
50
51
/*
* Copyright © 2011 QUALCOMM Incorporated. All rights reserved.
*
* This software is the confidential and proprietary information of
* QUALCOMM Incorporated ("Proprietary Information"). You shall not
* disclose such Proprietary Information, and shall use it only in
* accordance with the terms of the license agreement you entered into
* with QUALCOMM Incorporated.
*/
package com.parking.findparking;
import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;
import com.parking.dashboard.R;
public class FindParkingTabs extends TabActivity{
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.map_list_tabs);
Resources res = getResources(); // Resource object to get Drawables
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable 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, FindParkingMap.class);
// Initialize a TabSpec for each tab and add it to the TabHost
spec = tabHost.newTabSpec("map").setIndicator("Map",
res.getDrawable(R.drawable.location_map))
.setContent(intent);
tabHost.addTab(spec);
// Do the same for the other tab
intent = new Intent().setClass(this, FindParkingList.class);
spec = tabHost.newTabSpec("list").setIndicator("List",
res.getDrawable(R.drawable.tab_list))
.setContent(intent);
tabHost.addTab(spec);
tabHost.setCurrentTab(0);
}
}