コード例 #1
0
ファイル: ags.java プロジェクト: nhnam/ZaloRE
 public void a(TabHost.TabSpec paramTabSpec, Class<?> paramClass, Bundle paramBundle) {
   paramTabSpec.setContent(new agt(this.mContext));
   agu localagu = new agu(paramTabSpec.getTag(), paramClass, paramBundle);
   this.alL.add(localagu);
   this.Rk.addTab(paramTabSpec);
   notifyDataSetChanged();
 }
コード例 #2
0
ファイル: Activity_Tab.java プロジェクト: Dickjay/STOU-Ebooks
  private static void AddTab(
      Activity_Tab activity,
      TabHost tabHost,
      TabHost.TabSpec tabSpec,
      TabInfo tabInfo,
      String label,
      int drawable) {
    tabSpec.setContent(activity.new TabFactory(activity));

    View tabIndicator =
        LayoutInflater.from(activity)
            .inflate(R.layout.tab_indicator, tabHost.getTabWidget(), false);
    TextView txtTitle = (TextView) tabIndicator.findViewById(R.id.title);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);

    txtTitle.setText(label);
    txtTitle.setTextSize(
        Float.parseFloat(activity.getResources().getString(R.string.size_pointer)));
    txtTitle.setTypeface(StaticUtils.getTypeface(activity, Font.THSarabanNew));
    icon.setImageResource(drawable);

    tabSpec.setIndicator(tabIndicator);

    tabHost.addTab(tabSpec);
  }
コード例 #3
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    _context = getApplicationContext();

    Resources res = getResources();
    articlesHelper = ArticleTableHelper.getInstance(_context, this);
    TabHost tabHost = getTabHost();
    TabHost.TabSpec spec1 = tabHost.newTabSpec("all_post");
    TabHost.TabSpec spec2 = tabHost.newTabSpec("new_post");

    flushConfirmDialog =
        new AlertDialog.Builder(this)
            .setTitle(R.string.alert)
            .setMessage(R.string.flush_article_really)
            .setPositiveButton(R.string.yes, this)
            .setNegativeButton(R.string.no, this)
            .create();

    spec1
        .setIndicator(res.getString(R.string.all_post), res.getDrawable(R.drawable.all_post))
        .setContent(new Intent(_context, AllPostActivity.class));
    spec2
        .setIndicator(res.getString(R.string.new_post), res.getDrawable(R.drawable.new_post))
        .setContent(new Intent(_context, NewPostActivity.class));

    tabHost.addTab(spec1);
    tabHost.addTab(spec2);
    tabHost.setCurrentTab(0);
  }
コード例 #4
0
ファイル: Patchy.java プロジェクト: ebadia/cw-andtutorials
  @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);
  }
コード例 #5
0
    public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
      tabSpec.setContent(new DummyTabFactory(mContext));
      String tag = tabSpec.getTag();

      TabInfo info = new TabInfo(tag, clss, args);
      mTabs.add(info);
      mTabHost.addTab(tabSpec);
      notifyDataSetChanged();
    }
コード例 #6
0
ファイル: TagViewActivity.java プロジェクト: ghy/astrid
 private void addTab(TabWidget tabWidget, int contentId, String id, String label) {
   TabHost.TabSpec spec = tabHost.newTabSpec(id);
   spec.setContent(contentId);
   TextView textIndicator =
       (TextView) getLayoutInflater().inflate(R.layout.gd_tab_indicator, tabWidget, false);
   textIndicator.setText(label);
   spec.setIndicator(textIndicator);
   tabHost.addTab(spec);
 }
コード例 #7
0
  private void initTab(
      String tabId, int tabContentId, int tabTitleTextId, ListController listController) {
    TabHost.TabSpec spec = tabHost.newTabSpec(tabId);
    spec.setContent(tabContentId);
    spec.setIndicator(getString(tabTitleTextId));
    tabHost.addTab(spec);

    listControllers.put(tabId, listController);
  }
コード例 #8
0
 private void addTwitterTab()
 {
     android.widget.TabHost.TabSpec tabspec = mTabHost.newTabSpec("twitter");
     tabspec.setIndicator(getTabIndicator(0x7f0e0250, 0x7f09004c));
     Bundle bundle = new Bundle();
     bundle.putBoolean("from_sign_up", true);
     bundle.putInt("empty_desc", 0x7f0e00ef);
     mTabsAdapter.addTab(tabspec, co/vine/android/FindFriendsTwitterFragment, bundle);
 }
コード例 #9
0
ファイル: MainActivity.java プロジェクト: ImInnocent/Johnny
  private void setupTab(final View view, final String tag) {
    View tabview = createTabView(tabHost.getContext(), tag);

    // TabSpec은 공개된 생성자가 없으므로 직접 생성할 수 없으며, TabHost의 newTabSpec메서드로 생성
    TabHost.TabSpec setContent = tabHost.newTabSpec(tag).setIndicator(tabview);

    if (tag.equals("알람")) setContent.setContent(new Intent(this, AlarmActivity.class));
    else if (tag.equals("친구")) setContent.setContent(new Intent(this, FriendActivity.class));
    else if (tag.equals("설정")) setContent.setContent(new Intent(this, SettingActivity.class));

    tabHost.addTab(setContent);
  }
コード例 #10
0
 private void addContactsTab()
 {
     android.widget.TabHost.TabSpec tabspec = mTabHost.newTabSpec("address");
     tabspec.setIndicator(getTabIndicator(0x7f0e008f, 0x7f09004a));
     Bundle bundle = new Bundle();
     if (mIsTwitterReg)
     {
         bundle.putBoolean("take_focus", false);
     }
     bundle.putInt("empty_desc", 0x7f0e00e1);
     mTabsAdapter.addTab(tabspec, co/vine/android/FindFriendsNUXAddressFragment, bundle);
 }
コード例 #11
0
ファイル: MainActivity.java プロジェクト: 1c71/Learn-Android
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    //  1 初始化
    tabhost = (FragmentTabHost) findViewById(android.R.id.tabhost);
    tabhost.setup(this, getSupportFragmentManager(), R.id.activity_home_container);

    // 2 新建 TabSpec
    TabHost.TabSpec spec = tabhost.newTabSpec(TAG_CHAT);
    spec.setIndicator("消息");

    // 3 添加 TabSpec
    tabhost.addTab(spec, MyFragment.class, null);
  }
コード例 #12
0
  private void addTab(String labelId, int drawableId, Class<?> c) {
    TabHost tabHost = getTabHost();
    Intent intent = new Intent(this, c);
    TabHost.TabSpec spec = tabHost.newTabSpec("tab" + labelId);

    View tabIndicator =
        LayoutInflater.from(this).inflate(R.layout.tab_indicator, getTabWidget(), false);
    TextView title = (TextView) tabIndicator.findViewById(R.id.title);
    title.setText(labelId);
    ImageView icon = (ImageView) tabIndicator.findViewById(R.id.icon);
    icon.setImageResource(drawableId);

    spec.setIndicator(tabIndicator);
    spec.setContent(intent);
    tabHost.addTab(spec);
  }
コード例 #13
0
  protected void initTabs() {
    LayoutInflater inflater = LayoutInflater.from(FindPwdTabsActivity.this);
    View phoneView = inflater.inflate(R.layout.common_tabbar_item_lightblue, null);
    ((HandyTextView) phoneView.findViewById(R.id.tabbar_item_htv_label)).setText("手机号码");
    TabHost.TabSpec phoneTabSpec =
        mTabHost.newTabSpec(FindPwdPhoneActivity.class.getName()).setIndicator(phoneView);
    phoneTabSpec.setContent(new Intent(FindPwdTabsActivity.this, FindPwdPhoneActivity.class));
    mTabHost.addTab(phoneTabSpec);

    View emailView = inflater.inflate(R.layout.common_tabbar_item_lightblue, null);
    ((HandyTextView) emailView.findViewById(R.id.tabbar_item_htv_label)).setText("电子邮箱");
    emailView.findViewById(R.id.tabbar_item_ligthblue_driver_left).setVisibility(View.VISIBLE);
    TabHost.TabSpec emailTabSpec =
        mTabHost.newTabSpec(FindPwdEmailActivity.class.getName()).setIndicator(emailView);
    emailTabSpec.setContent(new Intent(FindPwdTabsActivity.this, FindPwdEmailActivity.class));
    mTabHost.addTab(emailTabSpec);
  }
    public void addTab(TabHost.TabSpec tabSpec, Class<?> clss) {
      tabSpec.setContent(new DummyTabFactory(mContext));

      TabInfo info = new TabInfo(clss);
      mTabs.add(info);
      mTabHost.addTab(tabSpec);
      notifyDataSetChanged();
    }
コード例 #15
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    TabHost host = (TabHost) findViewById(R.id.tab_host);
    host.setup();

    // Tab 1
    TabHost.TabSpec spec = host.newTabSpec("Timeline");
    spec.setContent(R.id.tab1);
    spec.setIndicator("Timeline");
    host.addTab(spec);

    // Tab 2
    spec = host.newTabSpec("Direct Message");
    spec.setContent(R.id.tab2);
    spec.setIndicator("Direct Message");
    host.addTab(spec);

    // Tab 3
    spec = host.newTabSpec("Profile");
    spec.setContent(R.id.tab3);
    spec.setIndicator("Profile");
    host.addTab(spec);
  }
コード例 #16
0
 public void addTab(TabHost.TabSpec paramTabSpec, Class<?> paramClass, Bundle paramBundle)
 {
   paramTabSpec.setContent(new DummyTabFactory(this.mContext));
   String str = paramTabSpec.getTag();
   TabInfo localTabInfo = new TabInfo(str, paramClass, paramBundle);
   if (this.mAttached)
   {
     TabInfo.access$102(localTabInfo, this.mFragmentManager.findFragmentByTag(str));
     if ((localTabInfo.fragment != null) && (!localTabInfo.fragment.isDetached()))
     {
       FragmentTransaction localFragmentTransaction = this.mFragmentManager.beginTransaction();
       localFragmentTransaction.detach(localTabInfo.fragment);
       localFragmentTransaction.commit();
     }
   }
   this.mTabs.add(localTabInfo);
   addTab(paramTabSpec);
 }
コード例 #17
0
  /**
   * Ajout d'une tab au conteneur
   *
   * @param activity activit� concern�e
   * @param tabHost Hote des Tabs
   * @param tabSpec nouvelle spec de la tab
   * @param tabInfo infos de la � cr�er
   */
  private static void addTab(
      DiffusionTabActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) {

    // On Attache une factory � la spec de la tab
    tabSpec.setContent(activity.new TabFactory(activity));
    String tag = tabSpec.getTag();

    // On v�rifie si un fragment est d�j� li� � cette spec au quel cas
    // on le d�sactive afin de garantir l'�tat initial cach�
    tabInfo.fragment = activity.getSupportFragmentManager().findFragmentByTag(tag);
    if (tabInfo.fragment != null && !tabInfo.fragment.isDetached()) {
      FragmentTransaction ft = activity.getSupportFragmentManager().beginTransaction();
      ft.detach(tabInfo.fragment);
      ft.commit();
      activity.getSupportFragmentManager().executePendingTransactions();
    }
    tabHost.addTab(tabSpec);
  }
コード例 #18
0
ファイル: TabManager.java プロジェクト: AreYouLoco/openbmap
  public void addTab(final TabHost.TabSpec tabSpec, final Class<?> clss, final Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mActivity));
    final String tag = tabSpec.getTag();

    final TabInfo info = new TabInfo(tag, clss, args);

    // Check to see if we already have a fragment for this tab, probably
    // from a previously saved state. If so, deactivate it, because our
    // initial state is that a tab isn't shown.
    info.fragment = mActivity.getSupportFragmentManager().findFragmentByTag(tag);
    if (info.fragment != null && !info.fragment.isDetached()) {
      final FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
      ft.detach(info.fragment);
      ft.commit();
    }

    mTabs.put(tag, info);
    mTabHost.addTab(tabSpec);
  }
コード例 #19
0
  @Override
  public void onCreate(Bundle icicle) {
    super.onCreate(icicle);
    setContentView(R.layout.main);

    TabHost tabs = (TabHost) findViewById(R.id.tabhost);
    tabs.setup();

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

    spec.setContent(R.id.tabPage1);
    spec.setIndicator("Document 1");
    tabs.addTab(spec);

    spec = tabs.newTabSpec("tag2");
    spec.setContent(R.id.tabPage2);
    spec.setIndicator("Document 2");
    tabs.addTab(spec);

    tabs.setCurrentTab(0);
  }
コード例 #20
0
ファイル: FragmentTabHost.java プロジェクト: yan96in/Baelish
  public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) {
    tabSpec.setContent(new DummyTabFactory(mContext));
    String tag = tabSpec.getTag();

    TabInfo info = new TabInfo(tag, clss, args);

    if (mAttached) {
      // If we are already attached to the window, then check to make
      // sure this tab's fragment is inactive if it exists.  This shouldn't
      // normally happen.
      info.fragment = mFragmentManager.findFragmentByTag(tag);
      if (info.fragment != null && !info.fragment.isDetached()) {
        FragmentTransaction ft = mFragmentManager.beginTransaction();
        ft.detach(info.fragment);
        ft.commit();
      }
    }

    mTabs.add(info);
    addTab(tabSpec);
  }
コード例 #21
0
 public void onCreate(Bundle paramBundle) {
   super.onCreate(paramBundle);
   requestWindowFeature(1);
   getWindow().setFlags(1024, 1024);
   // setContentView(2130903041);
   setContentView(R.layout.activity_help);
   Log.d("chilon", "help activity");
   TabHost localTabHost = (TabHost) findViewById(R.id.TabHost1);
   localTabHost.setup();
   TabHost.TabSpec localTabSpec1 = localTabHost.newTabSpec("instructions");
   localTabSpec1.setIndicator(getResources().getString(R.string.tab_text));
   localTabSpec1.setContent(R.id.ScrollViewHelpText);
   localTabHost.addTab(localTabSpec1);
   TabHost.TabSpec localTabSpec2 = localTabHost.newTabSpec("example");
   localTabSpec2.setIndicator(getResources().getString(R.string.tab_image));
   localTabSpec2.setContent(R.id.ScrollViewHelpImage);
   localTabHost.addTab(localTabSpec2);
   localTabHost.setCurrentTabByTag("instructions");
   ImageView localImageView = (ImageView) findViewById(R.id.imageViewHelp);
   DisplayMetrics localDisplayMetrics = new DisplayMetrics();
   getWindowManager().getDefaultDisplay().getMetrics(localDisplayMetrics);
   int i = localDisplayMetrics.widthPixels;
   int j = localDisplayMetrics.heightPixels;
   Log.d("chilon", "onpost create for Help - width  " + i);
   if (i < j) localImageView.setImageResource(R.drawable.help);
   while (true) {
     localImageView.setImageResource(R.drawable.helpland);
   }
 }
コード例 #22
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);
 }
コード例 #23
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    helper = new RestaurantHelper(this);

    name = (EditText) findViewById(R.id.name);
    address = (EditText) findViewById(R.id.addr);
    notes = (EditText) findViewById(R.id.notes);
    types = (RadioGroup) findViewById(R.id.types);

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

    save.setOnClickListener(onSave);

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

    model = helper.getAll();
    startManagingCursor(model);
    adapter = new RestaurantAdapter(model);
    list.setAdapter(adapter);

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

    spec.setContent(R.id.restaurants);
    spec.setIndicator("List", getResources().getDrawable(R.drawable.list));
    getTabHost().addTab(spec);

    spec = getTabHost().newTabSpec("tag2");
    spec.setContent(R.id.details);
    spec.setIndicator("Details", getResources().getDrawable(R.drawable.restaurant));
    getTabHost().addTab(spec);

    getTabHost().setCurrentTab(0);

    list.setOnItemClickListener(onListClick);
  }
コード例 #24
0
  /**
   * There is one chart for each signal type. Returns the chart component of a specific signal type.
   *
   * @return
   */
  public LineChart getChart(String signalTypeId) {
    if (!charts.containsKey(signalTypeId)) {
      // Create a chart component
      // chart = (LineChart) findViewById(R.id.chart);
      final LineChart chart = new LineChart(this);
      // chart.setUnit("Db");
      chart.setUnit("");
      // chart.setDrawUnitsInChart(true);
      chart.setDrawYValues(false);
      chart.setDrawBorder(false);
      chart.setTouchEnabled(true);
      chart.setDragEnabled(true);
      chart.setNoDataTextDescription("No data gathered.");
      chart.setDescription("Samples");
      chart.setPinchZoom(true); // if disabled, scaling can be done on x- and y-axis separately
      // set an alternative background color
      // mChart.setBackgroundColor(Color.GRAY)

      // Creates a chart tab.
      // http://www.java2s.com/Code/Android/UI/DynamicTabDemo.htm
      // http://www.java2s.com/Code/Android/UI/UsingatabcontentfactoryforthecontentviaTabHostTabSpecsetContentandroidwidgetTabHostTabContentFactory.htm
      TabHost.TabSpec spec = tabHost.newTabSpec(signalTypeId);
      spec.setIndicator(signalTypeId);
      spec.setContent(
          new TabHost.TabContentFactory() {
            public View createTabContent(String tag) {
              return chart;
            }
          });
      tabHost.addTab(spec);
      // addContentToTab(tabHost.getChildCount(), chart);

      charts.put(signalTypeId, chart);
      tabHost.invalidate();
    }

    return charts.get(signalTypeId);
  }
コード例 #25
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // tab1
    TabHost TbH = (TabHost) findViewById(R.id.tabHost); // llamamos al Tabhost
    TbH.setup(); // lo activamos

    TabHost.TabSpec tab1 = TbH.newTabSpec("tab1"); // aspectos de cada Tab (pestaña)
    TabHost.TabSpec tab2 = TbH.newTabSpec("tab2");
    TabHost.TabSpec tab3 = TbH.newTabSpec("tab3");

    tab1.setIndicator("UNO"); // qué queremos que aparezca en las pestañas
    tab1.setContent(R.id.ejemplo1); // definimos el id de cada Tab (pestaña)

    tab2.setIndicator("DOS");
    tab2.setContent(R.id.ejemplo2);

    tab3.setIndicator("TRES");
    tab3.setContent(R.id.ejemplo3);

    TbH.addTab(tab1); // añadimos los tabs ya programados
    TbH.addTab(tab2);
    TbH.addTab(tab3);
  }
コード例 #26
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_pm);
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);

    TabHost.TabSpec tab1 = tabHost.newTabSpec("Gelen");
    TabHost.TabSpec tab2 = tabHost.newTabSpec("Giden");

    tab1.setIndicator("Gelen");
    tab1.setContent(new Intent(this, GelenPMActivity.class));

    tab2.setIndicator("Giden");
    tab2.setContent(new Intent(this, GidenPmActivity.class));

    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
  }
コード例 #27
0
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    /// create the TabHost that will contain the Tabs
    TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
    TabHost.TabSpec tab1 = tabHost.newTabSpec("First Tab");
    TabHost.TabSpec tab2 = tabHost.newTabSpec("Second Tab");

    // Set the Tab name and Activity
    // that will be opened when particular Tab will be selected
    tab1.setIndicator("User Events");
    tab1.setContent(new Intent(this, EventActivity.class));

    tab2.setIndicator("Driving");
    tab2.setContent(new Intent(this, DrivingActivity.class));

    /** Add the tabs to the TabHost to display. */
    tabHost.addTab(tab1);
    tabHost.addTab(tab2);
  }
コード例 #28
0
ファイル: TabDemo.java プロジェクト: rythos42/Gaggle
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // FIXME - change to use a menu like the web browser app (instead of tabs)

    setContentView(R.layout.tabs);

    TabHost tabs = (TabHost) this.findViewById(android.R.id.tabhost);
    tabs.setup();

    TabHost.TabSpec one = tabs.newTabSpec("one");
    one.setContent(R.id.content1);
    one.setIndicator("labelone", this.getResources().getDrawable(R.drawable.icon));
    // one.setIndicator("One");
    tabs.addTab(one);

    TabHost.TabSpec two = tabs.newTabSpec("two");
    two.setContent(R.id.content2);
    two.setIndicator("Two");
    tabs.addTab(two);

    tabs.setCurrentTab(0);
  }
コード例 #29
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.mainapp);

    TableLayout t1 = (TableLayout) findViewById(R.id.tableLayout1);
    TableLayout t2 = (TableLayout) findViewById(R.id.tableLayout2);
    TableLayout t3 = (TableLayout) findViewById(R.id.tableLayout3);

    t1.setVisibility(View.GONE);
    t2.setVisibility(View.GONE);
    t3.setVisibility(View.GONE);

    TabHost tabs = (TabHost) findViewById(R.id.TabHost01);

    tabs.setup();

    TabHost.TabSpec spec1 = tabs.newTabSpec("tag1");

    spec1.setContent(R.id.myPlacesList);
    spec1.setIndicator(
        getString(R.string.maTabPlaces),
        getResources().getDrawable(android.R.drawable.ic_menu_mylocation));

    tabs.addTab(spec1);

    TabHost.TabSpec spec2 = tabs.newTabSpec("tag2");
    spec2.setContent(R.id.myRoutesList);
    spec2.setIndicator(
        getString(R.string.maTabRoutes),
        getResources().getDrawable(android.R.drawable.ic_menu_myplaces));

    tabs.addTab(spec2);

    myPlaces = (ListView) findViewById(R.id.myPlacesList);
    myRoutes = (ListView) findViewById(R.id.myRoutesList);

    history = History.getHistory(this);
    routes = History.getRoutes(this);
    historyAdapter = new History.HistoryAdapter(this);
    routesAdapter = new History.RoutesAdapter(this);
    myPlaces.setAdapter(historyAdapter);
    myRoutes.setAdapter(routesAdapter);
    Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myPlacesList));
    Utils.setListViewHeightBasedOnChildren((ListView) findViewById(R.id.myRoutesList));

    myPlaces.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            HistoryItem h = history.get(arg2);

            String str = h.address;
            if (!h.name.equals("")) str = h.name;

            createShortcut(str, null, h.address);
          }
        });

    myRoutes.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
            RouteHistoryItem r = routes.get(arg2);
            String n1 = r.start.substring(0, 5);
            if (r.start.length() > 0) n1 += ".";
            String n2 = r.end; // .substring(0, 5); if (r.end.length() > 0) n2 +=".";
            Utils.addHomeScreenShortcut(
                ShortcutActivity.this, n1 + "-" + n2, r.start, r.end, r.coords, r.coords2);
          }
        });
  }
コード例 #30
0
ファイル: EC_Eracer.java プロジェクト: piyushroshan/Tathva12
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);

    setContentView(R.layout.ec_eracer);

    TabHost tabs = (TabHost) findViewById(R.id.tabhost_ec_eracer);

    tabs.setup();

    TabHost.TabSpec spec1 = tabs.newTabSpec("intro");

    spec1.setContent(R.id.linear_ec_eracer_intro);
    spec1.setIndicator("  Introduction  ");

    tabs.addTab(spec1);

    TabHost.TabSpec spec4 = tabs.newTabSpec("eventspecifications");

    spec4.setContent(R.id.linear_ec_eracer_specs);
    spec4.setIndicator("  Event Specifications  ");

    tabs.addTab(spec4);

    TabHost.TabSpec spec11 = tabs.newTabSpec("teamspecifications");

    spec11.setContent(R.id.linear_ec_eracer_team_specs);
    spec11.setIndicator("  Team Specifications  ");

    tabs.addTab(spec11);

    TabHost.TabSpec spec7 = tabs.newTabSpec("criteria");

    spec7.setContent(R.id.linear_ec_eracer_judge);
    spec7.setIndicator("  Judging Criteria  ");

    tabs.addTab(spec7);

    TabHost.TabSpec spec3 = tabs.newTabSpec("Contact");

    spec3.setContent(R.id.linear_ec_eracer_contact);
    spec3.setIndicator("  Contact  ");

    tabs.addTab(spec3);

    TabHost.TabSpec spec12 = tabs.newTabSpec("Prizes");

    spec12.setContent(R.id.linear_ec_eracer_prize);
    spec12.setIndicator("  Prizes  ");

    tabs.addTab(spec12);
  }