private void initButtons() {
    final TabActivity tabActivity = (TabActivity) getParent();
    final Intent toMenuListActivity = new Intent(this, MenuListActivity.class);

    back_btn = (ImageButton) tabActivity.findViewById(R.id.list_back);
    back_btn.setOnTouchListener(
        new OnTouchListener() {
          @Override
          public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_DOWN) {

            } else if (event.getAction() == MotionEvent.ACTION_UP) {
              TabHost.TabSpec tab_spec_menu_list =
                  tabActivity
                      .getTabHost()
                      .newTabSpec(Constants.TAB_SPEC_TAG.MAIN_SPEC_TAG.getId())
                      .setIndicator(Constants.TAB_SPEC_TAG.MAIN_SPEC_TAG.getId());
              tab_spec_menu_list.setContent(toMenuListActivity);
              tabActivity.getTabHost().addTab(tab_spec_menu_list);
              tabActivity
                  .getTabHost()
                  .setCurrentTabByTag(Constants.TAB_SPEC_TAG.MAIN_SPEC_TAG.getId());
              Intent updateUiIntent = new Intent(Constants.UPDATE_UI_ACTION);
              sendBroadcast(updateUiIntent);
            }
            return false;
          }
        });
  }
Example #2
0
  @Test
  public void tabActivityShouldNotMakeNewTabHostEveryGet() throws Exception {
    TabActivity activity = new TabActivity();
    TabHost tabHost1 = activity.getTabHost();
    TabHost tabHost2 = activity.getTabHost();

    assertThat(tabHost1, equalTo(tabHost2));
  }
Example #3
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_fourth);

    tabHost = getTabHost();

    tabHost.addTab(
        tabHost
            .newTabSpec("111")
            .setIndicator("", getResources().getDrawable(R.drawable.wuyong))
            .setContent(R.id.tab1));

    tabHost.addTab(
        tabHost
            .newTabSpec("222")
            .setIndicator("", getResources().getDrawable(R.drawable.gongsunsheng))
            .setContent(R.id.tab2));

    tabHost.addTab(
        tabHost
            .newTabSpec("333")
            .setIndicator("", getResources().getDrawable(R.drawable.likui))
            .setContent(R.id.tab3));

    tabHost.setBackgroundColor(Color.argb(150, 22, 70, 150));
    tabHost.setCurrentTab(0);
    tabHost.setOnTabChangedListener(
        new OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabId) {
            Toast.makeText(FourthActivity.this, tabId, Toast.LENGTH_SHORT).show();
          }
        });
  }
Example #4
0
  public void onCreate(Bundle savedInstanceState) {
    Log.i(TAG, "onCreate()");
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, UseActivity.class);
    spec =
        tabHost
            .newTabSpec("use")
            .setIndicator("", res.getDrawable(R.drawable.ic_tab_use))
            .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, HostActivity.class);
    spec =
        tabHost
            .newTabSpec("host")
            .setIndicator("", res.getDrawable(R.drawable.ic_tab_host))
            .setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }
 @Override
 public void onStop() {
   super.onStop();
   if (mSearchTask != null) {
     mSearchTask.cancel(true);
   }
 }
Example #6
0
 @Override
 public boolean onCreateOptionsMenu(Menu menu) {
   super.onCreateOptionsMenu(menu);
   MenuItem item = menu.add(0, LICENSE, 0, "Sobre");
   item.setOnMenuItemClickListener(new MenuSobreItem());
   return true;
 }
Example #7
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.tabhost);

    tabhost = getTabHost();

    View view = View.inflate(this, R.layout.tab, null);
    ((ImageView) view.findViewById(R.id.img)).setImageResource(R.drawable.account_icon_kaixin);
    ((TextView) view.findViewById(R.id.text)).setText(kaixin);
    tabhost.addTab(
        tabhost
            .newTabSpec("kaixin")
            .setIndicator(view)
            .setContent(new Intent(this, OtherActivity.class)));

    View view1 = View.inflate(this, R.layout.tab, null);
    ((ImageView) view1.findViewById(R.id.img)).setImageResource(R.drawable.account_icon_qzone);
    ((TextView) view1.findViewById(R.id.text)).setText(qzone);
    tabhost.addTab(
        tabhost
            .newTabSpec("qzone")
            .setIndicator(view1)
            .setContent(new Intent(this, OtherActivity.class)));

    View view2 = View.inflate(this, R.layout.tab, null);
    ((ImageView) view2.findViewById(R.id.img)).setImageResource(R.drawable.account_icon_renren);
    ((TextView) view2.findViewById(R.id.text)).setText(renren);
    tabhost.addTab(
        tabhost
            .newTabSpec("renren")
            .setIndicator(view2)
            .setContent(new Intent(this, OtherActivity.class)));

    View view3 = View.inflate(this, R.layout.tab, null);
    ((ImageView) view3.findViewById(R.id.img)).setImageResource(R.drawable.account_icon_tencent);
    ((TextView) view3.findViewById(R.id.text)).setText(tencent);
    tabhost.addTab(
        tabhost
            .newTabSpec("tencent")
            .setIndicator(view3)
            .setContent(new Intent(this, OtherActivity.class)));

    View view4 = View.inflate(this, R.layout.tab, null);
    ((ImageView) view4.findViewById(R.id.img)).setImageResource(R.drawable.account_icon_weibo);
    ((TextView) view4.findViewById(R.id.text)).setText(weibo);
    tabhost.addTab(
        tabhost
            .newTabSpec("weibo")
            .setIndicator(view4)
            .setContent(new Intent(this, OtherActivity.class)));

    tabhost.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabId) {
            Toast.makeText(MyTabHostActivity.this, "===" + tabId, Toast.LENGTH_SHORT).show();
          }
        });
  }
Example #8
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.cgmedicine);

    TabHost tabHost = getTabHost();

    // Tab for Current
    TabSpec medspec = tabHost.newTabSpec("Medication Info");
    // setting Title and Icon for the Tab
    medspec.setIndicator(
        "Current Summary", getResources().getDrawable(R.drawable.icon_medicine_tab));
    Intent medIntent = new Intent(this, MedicineTab.class);
    medspec.setContent(medIntent);

    // Tab for History
    TabSpec hisspec = tabHost.newTabSpec("Past Medication");
    hisspec.setIndicator("Past Summary", getResources().getDrawable(R.drawable.ic_whats_hot));
    Intent histIntent = new Intent(this, MedicineHistoryTab.class);
    hisspec.setContent(histIntent);

    // Adding all TabSpec to TabHost
    tabHost.addTab(medspec); // Adding MED tab
    tabHost.addTab(hisspec); // Adding history tab
  }
Example #9
0
  @Override
  protected void onPause() {
    super.onPause();
    unregisterReceiver(controlReceiver);

    if (shouldSaveState) save();
  }
Example #10
0
 @Override
 public void onPause() {
   for (Bookmark bookmark : AllBooksBookmarks) {
     bookmark.save();
   }
   super.onPause();
 }
  public void onCreate(Bundle savedInstanceState) {
    if (isLightTheme(this)) {
      setTheme(R.style.Theme_Light);
    }
    super.onCreate(savedInstanceState);

    // We need to display progress information
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    setContentView(R.layout.tabs);
    INSTANCE = this;
    hasContent = false;
    visitedTabs = new Vector<String>(3);
    if (getPreferences(MODE_PRIVATE).getBoolean(Strings.PREFERENCE_LICENSEACCEPTED, false)) {
      setContent();
    } else {
      /* Workaround for android issue 4499 on 1.5 devices */
      getTabHost()
          .addTab(
              getTabHost()
                  .newTabSpec(Strings.EMPTY)
                  .setIndicator(Strings.EMPTY)
                  .setContent(new Intent(this, EmptyActivity.class)));

      showDialog(DIALOG_LICENSEAGREEMENT);
    }
  }
Example #12
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main_page);
    imageManager = new ImageManager(this);
    content = getContentResolver();
    //
    initNote();
    //
    tabHost = getTabHost();
    tabHost.addTab(
        tabHost
            .newTabSpec("tab1")
            .setIndicator("People")
            .setContent(new Intent(this, PeopleList.class)));

    tabHost.addTab(
        tabHost
            .newTabSpec("tab2")
            .setIndicator("Here & Now")
            .setContent(
                new Intent(this, HereAndNowList.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));

    tabHost.addTab(
        tabHost
            .newTabSpec("tab3")
            .setIndicator("My Faves")
            .setContent(
                new Intent(this, MyFaveList.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)));
  }
  @Override
  protected void onDestroy() {

    myTPad.stopTPad();
    myHapticView.destroy();
    super.onDestroy();
  }
Example #14
0
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.activity_forumeafc);
   final GlobalClass globalVariable = (GlobalClass) getApplicationContext();
   show1 = (TextView) findViewById(R.id.show2);
   show1.setText("Astro Medical Chart");
   back1 = (ImageButton) findViewById(R.id.back);
   back1.setOnClickListener(
       new View.OnClickListener() {
         public void onClick(View v) {
           if (globalVariable.getEmail() == null) {
             Intent intenthome = new Intent(getApplicationContext(), UserActivity.class);
             intenthome.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
             startActivity(intenthome);
           } else {
             Intent intenthome = new Intent(getApplicationContext(), MainActivity.class);
             intenthome.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
             startActivity(intenthome);
           }
         }
       });
   TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
   tabHost.getTabWidget().setDividerDrawable(null);
   TabHost.TabSpec firstTabSpec = tabHost.newTabSpec("tid1");
   TabHost.TabSpec secondTabSpec = tabHost.newTabSpec("tid1");
   TabHost.TabSpec thirdTabSpec = tabHost.newTabSpec("tid1");
   firstTabSpec.setIndicator("Inforamtion").setContent(new Intent(this, FirstTab.class));
   secondTabSpec
       .setIndicator("Query Form")
       .setContent(new Intent(this, AmcRequest1Activity.class));
   thirdTabSpec.setIndicator("Status").setContent(new Intent(this, ThirdTabAmc.class));
   tabHost.addTab(firstTabSpec);
   tabHost.addTab(secondTabSpec);
   tabHost.addTab(thirdTabSpec);
 }
Example #15
0
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.tab_layout);

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(this, Bazaar.class);
    spec =
        tabHost
            .newTabSpec("bazaar")
            .setIndicator("Bazaar", res.getDrawable(R.drawable.spell_purple))
            .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, Summary.class);
    spec =
        tabHost
            .newTabSpec("summary")
            .setIndicator("Summary", res.getDrawable(R.drawable.spell_green))
            .setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }
Example #16
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.pie_chart_tab);

    btnBack = (Button) findViewById(R.id.btnBackPie);
    btnBack.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            finish();
          }
        });

    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent().setClass(getApplicationContext(), MemoryPieChartActivity.class);
    spec =
        tabHost
            .newTabSpec("MemoryPieChartActivity")
            .setIndicator("Memory Usage", null)
            .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(getApplicationContext(), CPUPieChart.class);
    spec = tabHost.newTabSpec("CPU").setIndicator("CPUPieChart", null).setContent(intent);
    tabHost.addTab(spec);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_groupe_vendeur);

    try {
      tabHost = getTabHost();

      tabHost.addTab(
          tabHost
              .newTabSpec("Tab1")
              .setIndicator(TAG_TYERS)
              .setContent(new Intent().setClass(this, VendeurActivity.class)));

      tabHost.addTab(
          tabHost
              .newTabSpec("Tab2")
              .setIndicator(TAG_BABES)
              .setContent(new Intent().setClass(this, MainActivity.class)));

      tabHost.setCurrentTab(0);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
Example #18
0
 @Override
 protected void onResume() {
   super.onResume();
   registerReceiver(
       controlReceiver, new IntentFilter(AstridApiConstants.BROADCAST_SEND_EDIT_CONTROLS));
   populateFields();
 }
  protected void onDestroy() {
    JActivityManager.getInstance().removeActivity(this);
    this.unregisterReceiver(this.mBroadcastReceiver);
    this.mBroadcastReceiver = null;
    this.filter = null;
    if (this.mActivityParameters != null) {
      this.mActivityParameters.clear();
    }

    this.mActivityParameters = null;
    this.stopTask();
    this.mActivityTask = null;
    if (this.mBroadcastParametersInner != null) {
      this.mBroadcastParametersInner.clear();
    }

    this.mBroadcastParametersInner = null;
    if (this.mBroadcastParametersProcess != null) {
      this.mBroadcastParametersProcess.clear();
    }

    this.mBroadcastParametersProcess = null;
    this.mStatus = JTabActivity.Status.DESTROYED;
    this.mContext = null;
    super.onDestroy();
  }
Example #20
0
  @Override
  protected void onSaveInstanceState(Bundle outState) {
    super.onSaveInstanceState(outState);

    // stick our task into the outState
    outState.putParcelable(TASK_IN_PROGRESS, model);
  }
Example #21
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec;
    Intent intent;

    intent = new Intent(getApplicationContext(), ListaNoticiasActivity.class);
    spec =
        tabHost
            .newTabSpec("noticias")
            .setIndicator("Blog", res.getDrawable(R.drawable.rss))
            .setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent(getApplicationContext(), ListaLocaisActivity.class);
    spec =
        tabHost
            .newTabSpec("locais")
            .setIndicator("Onde?", res.getDrawable(R.drawable.calendar))
            .setContent(intent);
    tabHost.addTab(spec);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.home_activity);
    m_tabHost = getTabHost();
    m_tabHost.setOnTabChangedListener(
        new TabHost.OnTabChangeListener() {
          @Override
          public void onTabChanged(String tabText) {
            if (TextUtils.equals(tabText, getResources().getString(R.string.tab_tag_mylikes))) {
              MyLikesActivity mla = (MyLikesActivity) getCurrentActivity();
              mla.loadMyLikes();
            }
            //				Toast.makeText(HomeActivity.this, arg0, Toast.LENGTH_LONG).show();
            //				Resources res = HomeActivity.this.getResources();
            //				if (TextUtils.equals(arg0, res.getString(R.string.tab_tag_home)) ||
            //						TextUtils.equals(arg0,  res.getString(R.string.tab_tag_special)) ||
            //						TextUtils.equals(arg0, res.getString(R.string.tab_tag_future))) {
            //					SharedDataActivity currentActivity = (SharedDataActivity)getCurrentActivity();
            //					if (!currentActivity.isReady()) {
            //						currentActivity.refresh();
            //					}
            //				}
          }
        });

    sInstance = this;
    initTabs();
    initSettings();
  }
  /** Called when the activity is first created. */
  @SuppressWarnings("deprecation")
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_details);
    populateExtras();

    // create the TabHost that will contain the Tabs
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);

    TextView detailSummary = (TextView) findViewById(R.id.detail_summary);
    detailSummary.setText("More Details" + this.city + "," + this.state);
    TabSpec tab1 = tabHost.newTabSpec("First Tab");
    TabSpec tab2 = tabHost.newTabSpec("Second Tab");

    tab1.setIndicator("Next 24 Hours");
    Intent i1 = new Intent(this, Next24Activity.class);
    putExtras(i1);
    tab1.setContent(i1);

    tab2.setIndicator("Next 7 Days");
    Intent i2 = new Intent(this, Next7Activity.class);
    putExtras(i2);
    tab2.setContent(i2);

    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.bankmobile);

    // Log onto server
    login();

    mTabHost = getTabHost(); // The activity TabHost
    Intent intent; // Reusable Intent for each tab

    // Create tab for accounts
    intent = new Intent().setClass(this, AccountsActivity.class);
    setupTab("Accounts", intent);

    // Create tab for fund transfer
    intent = new Intent().setClass(this, TransferActivity.class);
    setupTab("Transfer", intent);

    // Create tab for portfolio display
    intent = new Intent().setClass(this, PortfolioActivity.class);
    setupTab("Portfolio", intent);

    mTabHost.setCurrentTab(0);
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
    setContentView(R.layout.search_venues_activity);
    setDefaultKeyMode(Activity.DEFAULT_KEYS_SEARCH_LOCAL);
    registerReceiver(mLoggedOutReceiver, new IntentFilter(Foursquared.INTENT_ACTION_LOGGED_OUT));

    searchResultsObservable = new SearchResultsObservable();

    initTabHost();
    initListViewAdapter();

    // Watch to see if we've been called as a shortcut intent.
    mIsShortcutPicker = Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction());

    if (getLastNonConfigurationInstance() != null) {
      if (DEBUG) Log.d(TAG, "Restoring state.");
      SearchHolder holder = (SearchHolder) getLastNonConfigurationInstance();
      if (holder.results != null) {
        mSearchHolder.query = holder.query;
        setSearchResults(holder.results);
        putSearchResultsInAdapter(holder.results);
      }
    } else {
      onNewIntent(getIntent());
    }
  }
Example #26
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    Resources res = getResources(); // 리소스 객체 생성
    TabHost tabHost = getTabHost(); // 탭메뉴 액티비티 생성
    TabHost.TabSpec spec; // 각 탭의 메뉴와 컨텐츠를 위한 객체 선언
    Intent intent; // 각 탭에서 사용할 인텐트 선언

    // 인텐트 생성
    intent = new Intent().setClass(this, CustListActivity.class);

    // 각 탭의 메뉴와 컨텐츠를 위한 객체 생성
    spec = tabHost.newTabSpec("custList").setIndicator("고객현황").setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, CustRegActivity.class);
    spec = tabHost.newTabSpec("custReg").setIndicator("고객등록").setContent(intent);
    tabHost.addTab(spec);

    intent = new Intent().setClass(this, CustHelpActivity.class);
    spec = tabHost.newTabSpec("custHelp").setIndicator("도움말").setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }
Example #27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    status = (EditText) findViewById(R.id.status);

    Button send = (Button) findViewById(R.id.send);

    send.setOnClickListener(onSend);

    prefs = PreferenceManager.getDefaultSharedPreferences(this);
    prefs.registerOnSharedPreferenceChangeListener(prefListener);

    bindService(new Intent(ITwitterMonitor.class.getName()), svcConn, Context.BIND_AUTO_CREATE);

    adapter = new TimelineAdapter();

    ListView list = (ListView) findViewById(R.id.timeline);

    //		list.addHeaderView(buildHeader());
    list.setAdapter(adapter);
    list.setOnItemClickListener(onStatusClick);
    list.setOnItemSelectedListener(selectionListener);

    TabHost.TabSpec spec = getTabHost().newTabSpec("tag1");

    spec.setContent(R.id.status_tab);
    spec.setIndicator("Status", getResources().getDrawable(R.drawable.status));
    getTabHost().addTab(spec);

    spec = getTabHost().newTabSpec("tag2");
    spec.setContent(R.id.friends);
    spec.setIndicator("Friends", getResources().getDrawable(R.drawable.friends));
    getTabHost().addTab(spec);

    getTabHost().setCurrentTab(0);

    try {
      for (Twitter.User u : getClient().getFriends()) {
        friends.add(u.screenName);
      }
    } catch (Throwable t) {
      Log.e("Patchy", "Exception in JTwitter#getFriends()", t);
      goBlooey(t);
    }

    Collections.sort(friends);

    friendsList = (ListView) findViewById(R.id.friends);

    friendsAdapter =
        new ArrayAdapter<String>(this, android.R.layout.simple_list_item_multiple_choice, friends);
    friendsList.setAdapter(friendsAdapter);
    friendsList.setItemsCanFocus(false);
    friendsList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);

    locMgr = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locMgr.requestLocationUpdates(LocationManager.GPS_PROVIDER, 10000, 10000.0f, onLocationChange);
  }
Example #28
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    // 获取该Activity里面的TabHost组件
    TabHost tabHost = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.activity_main, tabHost.getTabContentView(), true);
    // 创建第一个Tab页
    TabSpec tabSpec1 = tabHost.newTabSpec("tab1").setIndicator("已接电话").setContent(R.id.tab01);
    // 添加第一个标签页
    tabHost.addTab(tabSpec1);

    // 创建第二个Tab页
    TabSpec tabSpec2 =
        tabHost
            .newTabSpec("tab2")
            // 注意R.drawable.icon,而不是R.id.icon
            .setIndicator("呼出电话", getResources().getDrawable(R.drawable.ic_launcher))
            .setContent(R.id.tab02);
    // 添加第二个标签页
    tabHost.addTab(tabSpec2);

    // 创建第3个Tab页
    TabSpec tabSpec3 = tabHost.newTabSpec("tab3").setIndicator("未接电话").setContent(R.id.tab03);
    // 添加第二个标签页
    tabHost.addTab(tabSpec3);
  }
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   this.requestWindowFeature(Window.FEATURE_NO_TITLE);
   this.setContentView(R.layout.activity_battledeckmanage);
   initTabs();
 }
Example #30
0
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainpage);

    startService(new Intent(getApplicationContext(), UnoService.class));

    Resources res = getResources();
    TabHost tabHost = getTabHost();
    TabSpec spec = null;
    Intent intent = null;

    // Local Home tab
    intent = new Intent().setClass(this, LocalHome.class);
    spec = tabHost.newTabSpec("home").setIndicator("Home").setContent(intent);
    tabHost.addTab(spec);

    // Uno Network tab
    intent = new Intent().setClass(this, UnoNetwork.class);
    spec = tabHost.newTabSpec("network").setIndicator("Network").setContent(intent);
    tabHost.addTab(spec);

    // Local Sensor tab
    intent = new Intent().setClass(this, LocalSensor.class);
    spec = tabHost.newTabSpec("sensor").setIndicator("Sensor").setContent(intent);
    tabHost.addTab(spec);

    // Search tab
    intent = new Intent().setClass(this, Search.class);
    spec = tabHost.newTabSpec("search").setIndicator("Search").setContent(intent);
    tabHost.addTab(spec);

    tabHost.setCurrentTab(0);
  }