BiDiTestActivity.java revision de35ceeeb9f8855c72dfd70593e917aa75b43770
1/* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package com.android.bidi; 18 19import android.app.TabActivity; 20import android.content.Intent; 21import android.os.Bundle; 22import android.widget.TabHost; 23 24public class BiDiTestActivity extends TabActivity { 25 26 @Override 27 protected void onCreate(Bundle savedInstanceState) { 28 super.onCreate(savedInstanceState); 29 30 setContentView(R.layout.main); 31 32 TabHost tabHost = getTabHost(); 33 TabHost.TabSpec spec; 34 Intent intent; 35 36 // Create an Intent to launch an Activity for the tab (to be reused) 37 intent = new Intent().setClass(this, BiDiTestBasicActivity.class); 38 39 // Initialize a TabSpec for each tab and add it to the TabHost 40 spec = tabHost.newTabSpec("basic").setIndicator("Basic"). 41 setContent(intent); 42 tabHost.addTab(spec); 43 44 // Do the same for the other tabs 45 intent = new Intent().setClass(this, BiDiTestCanvasActivity.class); 46 spec = tabHost.newTabSpec("canvas").setIndicator("Canvas"). 47 setContent(intent); 48 tabHost.addTab(spec); 49 50 intent = new Intent().setClass(this, BiDiTestLinearLayoutLtrActivity.class); 51 spec = tabHost.newTabSpec("linear-layout-ltr").setIndicator("LinearLayout LTR"). 52 setContent(intent); 53 tabHost.addTab(spec); 54 55 intent = new Intent().setClass(this, BiDiTestLinearLayoutRtlActivity.class); 56 spec = tabHost.newTabSpec("linear-layout-rtl").setIndicator("LinearLayout RTL"). 57 setContent(intent); 58 tabHost.addTab(spec); 59 60 intent = new Intent().setClass(this, BiDiTestFrameLayoutLtrActivity.class); 61 spec = tabHost.newTabSpec("frame-layout-ltr").setIndicator("FrameLayout LTR"). 62 setContent(intent); 63 tabHost.addTab(spec); 64 65 intent = new Intent().setClass(this, BiDiTestFrameLayoutRtlActivity.class); 66 spec = tabHost.newTabSpec("frame-layout-rtl").setIndicator("FrameLayout RTL"). 67 setContent(intent); 68 tabHost.addTab(spec); 69 70 tabHost.setCurrentTab(0); 71 } 72}