Java 类android.widget.TabHost.OnTabChangeListener 实例源码

项目:Interceptor    文件:MainActivity.java   
private void initView() {
    mAddItem = (LinearLayout) findViewById(R.id.main_add_item);
    mTabHost = (FragmentTabHost) findViewById(R.id.main_tabhost);
    mTabHost.setup(this, getSupportFragmentManager(), R.id.main_container);
    mTabHost.setBackgroundColor(getResources().getColor(R.color.bg_tabhost));
    mTabHost.getTabWidget().setDividerDrawable(null);
    mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals(BlackListFragmet.NAME)) {
                mActionBar.setTitle("黑名单", LocalActionBar.MIDDLE_TITLE);
        //        mAddItem.setVisibility(View.VISIBLE);
            } else {
                mActionBar.setTitle("添加", LocalActionBar.MIDDLE_TITLE);
        //        mAddItem.setVisibility(View.GONE);
            }
        }
    });
    addTabItem(BlackListFragmet.NAME, "黑名单", BlackListFragmet.TAB_ICON, BlackListFragmet.class);
    addTabItem(AddDataFragment.NAME, "添加", AddDataFragment.TAB_ICON, AddDataFragment.class);
}
项目:supergenpass-android    文件:Super_Gen_Pass.java   
private void initTabHost() {

        final TabHost mTabHost = (TabHost) findViewById(android.R.id.tabhost);

        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_password1, R.id.tab_password,
                "password1"));
        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_password2, R.id.tab_password,
                "password2"));        
        mTabHost.addTab(createTabSpec(mTabHost, R.string.tab_pin, R.id.tab_pin, "pin"));
        mTabHost.setOnTabChangedListener(new OnTabChangeListener() {

            @Override
            public void onTabChanged(String tabId) {
                if ("password1".equals(tabId)) {
                    hash = profiles[0];
                    generateIfValid();
                } else if ("password2".equals(tabId)) {
                    hash = profiles[1];
                    generateIfValid();
                }
            }
        });
    }
项目:faims-android    文件:FileGalleryPreviewDialog.java   
public FileGalleryPreviewDialog(Context context) {
    super(context);

    View dialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
    setView(dialogView);

    setButton(DialogInterface.BUTTON_POSITIVE, getContext().getResources().getString(R.string.confirm_dialog_button),
            new OnClickListener() {

                @Override
                public void onClick(DialogInterface dialog, int which) {
                    // do nothing
                }
            });

    tabHost = (TabHost) dialogView.findViewById(R.id.label_tabhost);
    tabHost.setup();

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            // Hide/show video preview so it's not visible in background on tab change
            if ("video_preview".equals(tabId)) {
                videoView.setVisibility(View.VISIBLE);
                videoView.start();
            } else {
                if (videoView != null) {
                    videoView.setVisibility(View.GONE);
                }
            }
        }
    });
}
项目:faims-android    文件:LabelDialog.java   
@SuppressLint("InflateParams")
public LabelDialog(Context context) {
    super(context);

    tabs = new ArrayList<String>();
    tabSpecs = new ArrayList<TabHost.TabSpec>();

    setButton(DialogInterface.BUTTON_NEGATIVE, getContext().getResources().getString(R.string.cancel_dialog_button),
            new OnClickListener() {

        @Override
        public void onClick(DialogInterface dialog, int which) {
            // User cancelled the dialog
        }
    });

    View labelDialogView = getLayoutInflater().inflate(R.layout.label_dialog, null);
    setView(labelDialogView);

    tabHost = (TabHost) labelDialogView.findViewById(R.id.label_tabhost);
    tabHost.setup();
    // Hide soft keyboard on tab change
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            handleTabChange(tabId);
        }
    });
}
项目:EquitmentInspection    文件:MainActivity.java   
private void init() {
    tabhost = this.getTabHost();

    first = tabhost.newTabSpec("first");
    second = tabhost.newTabSpec("second");      

    // ָ��ѡ������֣�ͼ��
    first.setIndicator(createContent("���", R.drawable.first_tab));
    second.setIndicator(createContent("����", R.drawable.two_tab));

    // ����ʾ��ҳ��
    first.setContent(new Intent(this, InspectionActivity.class));
    second.setContent(new Intent(this, SettingActivity.class));

    // ��ѡ��ӽ�TabHost
    tabhost.addTab(first);
    tabhost.addTab(second);
    //�趨��ǰTab
    tabhost.setCurrentTab(0);
    // ����tabHost�л�ʱ��̬����ͼ��
    tabhost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            tabChanged(tabId);
        }

    });

}
项目:apps4thess    文件:AlertsActivity.java   
/**
 * Initializes the tabhost and updates the viewpager when tab changed.
 */
private void initialiseTabHost() {
    _tabhost = (TabHost) findViewById(android.R.id.tabhost);
    _tabhost.setup();
    _tabhost.setOnTabChangedListener(new OnTabChangeListener() {

        @SuppressLint("NewApi")
        @Override
        public void onTabChanged(String tabId) {
            int pos = _tabhost.getCurrentTab();
            if(android.os.Build.VERSION.SDK_INT>=android.os.Build.VERSION_CODES.HONEYCOMB)
            {
                switch(pos)
                {
                case 0:
                    EasyTracker.getInstance(ctx).send(MapBuilder.createEvent("ui_action", "tab_change", "authority_info_tab", null).build());
                    getActionBar().setTitle("Authority Info");
                    invalidateOptionsMenu();
                    previousBackCount = backCount;
                    backCount = 0;
                    break;
                case 1:
                    EasyTracker.getInstance(ctx).send(MapBuilder.createEvent("ui_action", "tab_change", "user_info_tab", null).build());
                    getActionBar().setTitle("User Info");
                    invalidateOptionsMenu();
                    backCount = previousBackCount;
                }
            }
            _pager.setCurrentItem(pos);
        }
    });
}
项目:tzPalette    文件:ColorEditView.java   
private void initTabs()
{
    mTabHost = (TabHost)mView.findViewById(android.R.id.tabhost);
    mTabHost.setup();

    final TabSpec spec1 = mTabHost.newTabSpec(TAB_TAG_RGB);
    spec1.setContent(R.id.color_edit_view_tab_rgb);
    spec1.setIndicator(getString(R.string.color_edit_tab_rgb));

    final TabSpec spec2 = mTabHost.newTabSpec(TAB_TAG_RGB);
    spec2.setContent(R.id.color_edit_view_tab_hsv);
    spec2.setIndicator(getString(R.string.color_edit_tab_hsv));

    mTabHost.addTab(spec1);
    mTabHost.addTab(spec2);

    mTabHost.setOnTabChangedListener(new OnTabChangeListener(){
        @Override
        public void onTabChanged(String tabId)
        {
            updateColor();

            if (mCallback != null)
                mCallback.onTabChanged(ColorEditView.this, 
                                       mTabHost.getCurrentTab(), 
                                       mTabHost.getCurrentTabTag());
        }
    });
}
项目:Hi-Top    文件:MainActivity.java   
protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_tab);
        tabHost=this.getTabHost();


        //添加选项卡
        tabHost.addTab(tabHost.newTabSpec("TAB_GPS").setIndicator("TAB_GPS")
                    .setContent(new Intent(this, ui.activity.gps.GpsObtainActivity.class)));
        tabHost.addTab(tabHost.newTabSpec("TAB_MAP").setIndicator("TAB_MAP")
                .setContent(new Intent(this,ui.activity.GoogleMap.GMapActivity.class)));
        tabHost.addTab(tabHost.newTabSpec("TAB_WEATHER").setIndicator("TAB_WEATHER")
                .setContent(new Intent(this,ui.activity.weather.WeatherActivity.class))); 
//      tabHost.addTab(tabHost.newTabSpec("TAB_COMMUNITY").setIndicator("TAB_COMMUNITY")
//              .setContent(new Intent(this,ui.activity.community.CommunityActivity.class))); 
//      tabHost.addTab(tabHost.newTabSpec("TAB_COMMUNITY").setIndicator("TAB_COMMUNITY")
//              .setContent(new Intent(this,ui.activity.community.Communitymain.class))); 

        radioderGroup = (RadioGroup) findViewById(R.id.main_radio);
        radioderGroup.setOnCheckedChangeListener(this);

        this.tabHost.setOnTabChangedListener(new OnTabChangeListener() {

            @Override
            public void onTabChanged(String tabId) {
                // TODO Auto-generated method stub
            }
        });
    }
项目:letv    文件:FragmentTabHost.java   
public void setOnTabChangedListener(OnTabChangeListener l) {
    this.mOnTabChangeListener = l;
}
项目:boohee_v5.6    文件:FragmentTabHost.java   
public void setOnTabChangedListener(OnTabChangeListener l) {
    this.mOnTabChangeListener = l;
}
项目:solved-hacking-problem    文件:FragmentTabHost.java   
public void setOnTabChangedListener(OnTabChangeListener onTabChangeListener) {
    this.f78e = onTabChangeListener;
}
项目:gaeproxy    文件:BookmarksHistoryActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (Controller.getInstance().getPreferences()
            .getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    if (Controller
            .getInstance()
            .getPreferences()
            .getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
    }

    setContentView(R.layout.bookmarks_history_activity);

    setTitle(R.string.BookmarksListActivity_Title);

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

    // Bookmarks
    intent = new Intent().setClass(this, BookmarksListActivity.class);

    spec = tabHost
            .newTabSpec("bookmarks")
            .setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
                    res.getDrawable(R.drawable.ic_tab_bookmarks))
            .setContent(intent);
    tabHost.addTab(spec);

    // History
    intent = new Intent().setClass(this, HistoryListActivity.class);

    spec = tabHost
            .newTabSpec("history")
            .setIndicator(res.getString(R.string.Main_MenuShowHistory),
                    res.getDrawable(R.drawable.ic_tab_history))
            .setContent(intent);
    tabHost.addTab(spec);

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
            Constants.PREFERENCE_USE_WEAVE, false)) {
        // Weave bookmarks
        intent = new Intent().setClass(this,
                WeaveBookmarksListActivity.class);

        spec = tabHost
                .newTabSpec("weave")
                .setIndicator(
                        res.getString(R.string.WeaveBookmarksListActivity_Title),
                        res.getDrawable(R.drawable.ic_tab_weave))
                .setContent(intent);
        tabHost.addTab(spec);
    }

    tabHost.setCurrentTab(0);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals("bookmarks")) {
                setTitle(R.string.BookmarksListActivity_Title);
            } else if (tabId.equals("history")) {
                setTitle(R.string.HistoryListActivity_Title);
            } else if (tabId.equals("weave")) {
                setTitle(R.string.WeaveBookmarksListActivity_Title);
            } else {
                setTitle(R.string.ApplicationName);
            }
        }
    });
}
项目:ShoppingMall    文件:MainFragment.java   
@AfterViews
public void init() {
       mFragmentManager = getActivity().getSupportFragmentManager();
       mTabHost.setup(getActivity(), mFragmentManager, R.id.realtabcontent);

       mTabHost.addTab(createSpec(Constants.TAB_SEATCH_HOUSE, getString(R.string.main_tab_search_house)), GeneratedClassUtils.get(SearchHouseFragment.class), null);
       mTabHost.addTab(createSpec(Constants.TAB_POST, getString(R.string.main_tab_post)), GeneratedClassUtils.get(ReleaseFragment.class), null);
       mTabHost.addTab(createSpec(Constants.TAB_MINE, getString(R.string.main_tab_mine)), GeneratedClassUtils.get(MineFragment.class), null);

       mTabHost.setOnTabChangedListener(new OnTabChangeListener() {
           @Override
           public void onTabChanged(String tabId) {
               View searchHouseView = mTabHost.getTabWidget().getChildTabViewAt(0);
               View postView = mTabHost.getTabWidget().getChildTabViewAt(1);
               View mineView = mTabHost.getTabWidget().getChildTabViewAt(2);
               TextView searchTextView = (TextView) searchHouseView.findViewById(R.id.main_tab_item);
               TextView postTextView = (TextView) postView.findViewById(R.id.main_tab_item);
               TextView mineTextView = (TextView) mineView.findViewById(R.id.main_tab_item);
               if (tabId.equals(Constants.TAB_SEATCH_HOUSE)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_pre, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_org, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_org, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
               } else if (tabId.equals(Constants.TAB_POST)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_org, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_pre, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_org, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
               } else if (tabId.equals(Constants.TAB_MINE)) {
                   searchTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_search_org, 0, 0, 0);
                   searchTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   postTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_post_org, 0, 0, 0);
                   postTextView.setTextColor(Color.parseColor(Constants.UNSLECTED_TEXT_COLOR));
                   mineTextView.setCompoundDrawablesWithIntrinsicBounds(R.drawable.tabbar_ic_agent_pre, 0, 0, 0);
                   mineTextView.setTextColor(Color.parseColor(Constants.SLECTED_TEXT_COLOR));
               }
           }
       });

       mTabHost.getTabWidget().setDividerDrawable(null);

       mTabHost.setCurrentTab(1);
   }
项目:Chuangxinbei    文件:MainActivity1.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
       //requestWindowFeature(Window.FEATURE_NO_TITLE);
      // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    ViewUtils.inject(this);
    context = this;
    ActionBar actionBar = getActionBar();
       actionBar.setTitle("护眼精灵");
       listview = (ListView) findViewById(R.id.listviewApp);
       listview =new ListView(this);
       // tvInfo = (TextView)findViewById(R.id.tvInfo) ;
       mlistAppInfo = new ArrayList<RunningAppInfo>();
       listInfo =new ArrayList<RunningAppInfo>();
       pieView = (PieView) this.findViewById(R.id.lotteryView);
       pieView=new PieView(this,0);
       myButton=(MyButton)this.findViewById(R.id.MyBt);
      // myButton=new MyButton(this);
       textView=(TextView)this.findViewById(R.id.MyTV);
      // textView =new TextView(this);
       //initView();
       Intent intent = getIntent();
       int pid = intent.getIntExtra("EXTRA_PROCESS_ID", -1);
       //注册广播,监听后台Service发送过来的广播
       receiver = new UITimeReceiver();
       IntentFilter filter = new IntentFilter(TIME_CHANGED_ACTION);
       this.registerReceiver(receiver, filter);
       //启动服务,时间改变后发送广播,通知UI层修改时间
       startTimeService();
    // --------------------
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    tabHost.setup();
    tabHost.addTab(tabHost.newTabSpec("0").setIndicator(createTab("健康评估", 0)).setContent(android.R.id.tabcontent));
       tabHost.addTab(tabHost.newTabSpec("1").setIndicator(createTab("使用统计", 1)).setContent(android.R.id.tabcontent));
    tabHost.addTab(tabHost.newTabSpec("2").setIndicator(createTab("设置", 2)).setContent(android.R.id.tabcontent));
    // 点击tabHost 来切换不同的消息
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            int index = Integer.parseInt(tabId);
            setTabSelectedState(index, 3);
            tabHost.getTabContentView().setVisibility(View.GONE);// 隐藏content
        }
    });

       tabHost.setCurrentTab(0);
    initJazzyPager(TransitionEffect.Standard);



   }
项目:Chuangxinbei    文件:MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
       //requestWindowFeature(Window.FEATURE_NO_TITLE);
      // getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    setContentView(R.layout.activity_main);
    ViewUtils.inject(this);
    context = this;
    ActionBar actionBar = getActionBar();
       actionBar.setTitle("护眼精灵");
       listview = (ListView) findViewById(R.id.listviewApp);
       listview =new ListView(this);
       // tvInfo = (TextView)findViewById(R.id.tvInfo) ;
       mlistAppInfo = new ArrayList<RunningAppInfo>();
       listInfo =new ArrayList<RunningAppInfo>();
       pieView = (PieView) this.findViewById(R.id.lotteryView);
       pieView=new PieView(this,0);
       myButton=(MyButton)this.findViewById(R.id.MyBt);
      // myButton=new MyButton(this);
       textView=(TextView)this.findViewById(R.id.MyTV);
      // textView =new TextView(this);
       //initView();
       Intent intent = getIntent();
       int pid = intent.getIntExtra("EXTRA_PROCESS_ID", -1);
       //注册广播,监听后台Service发送过来的广播
       receiver = new UITimeReceiver();
       IntentFilter filter = new IntentFilter(TIME_CHANGED_ACTION);
       this.registerReceiver(receiver, filter);
       //启动服务,时间改变后发送广播,通知UI层修改时间
       startTimeService();
    // --------------------
    tabHost = (TabHost) findViewById(android.R.id.tabhost);
    tabHost.setup();
    tabHost.addTab(tabHost.newTabSpec("0").setIndicator(createTab("健康评估", 0)).setContent(android.R.id.tabcontent));
       tabHost.addTab(tabHost.newTabSpec("1").setIndicator(createTab("使用统计", 1)).setContent(android.R.id.tabcontent));
    tabHost.addTab(tabHost.newTabSpec("2").setIndicator(createTab("设置", 2)).setContent(android.R.id.tabcontent));
    // 点击tabHost 来切换不同的消息
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {
        @Override
        public void onTabChanged(String tabId) {
            int index = Integer.parseInt(tabId);
            setTabSelectedState(index, 3);
            tabHost.getTabContentView().setVisibility(View.GONE);// 隐藏content
        }
    });

       tabHost.setCurrentTab(0);
    initJazzyPager(TransitionEffect.Standard);



   }
项目:dialogdemo    文件:FragmentTabActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setContentView(R.layout.main);

    FragmentTabHost tabHost = (FragmentTabHost)findViewById(android.R.id.tabhost);
    tabHost.setup(this, getSupportFragmentManager(), R.id.realtabcontent);
    //1
    tabHost.addTab(tabHost.newTabSpec("Apple")
                          .setIndicator("Apple"), 
                      AppleFragment.class, 
                      null);
    //2
    tabHost.addTab(tabHost.newTabSpec("Google")
                          .setIndicator("Google"), 
                  GoogleFragment.class, 
                  null);
    //3
    tabHost.addTab(tabHost.newTabSpec("Facebook")
                          .setIndicator("Facebook"), 
                  FacebookFragment.class, 
                  null);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {

        }
    });

    back = (View) findViewById(R.id.navi_back);
       back.setOnClickListener(new View.OnClickListener() {

        @Override
        public void onClick(View v) {
            finish();

        }
    });
}
项目:zirco-browser    文件:BookmarksHistoryActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {        
    super.onCreate(savedInstanceState);

    if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {          
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       }

       if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
       }

    setContentView(R.layout.bookmarks_history_activity);

    setTitle(R.string.BookmarksListActivity_Title);

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

    // Bookmarks
    intent = new Intent().setClass(this, BookmarksListActivity.class);

    spec = tabHost.newTabSpec("bookmarks").setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
               res.getDrawable(R.drawable.ic_tab_bookmarks))
               .setContent(intent);
    tabHost.addTab(spec);

    // History
    intent = new Intent().setClass(this, HistoryListActivity.class);

    spec = tabHost.newTabSpec("history").setIndicator(res.getString(R.string.Main_MenuShowHistory),
               res.getDrawable(R.drawable.ic_tab_history))
               .setContent(intent);
    tabHost.addTab(spec);

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Constants.PREFERENCE_USE_WEAVE, false)) {
        // Weave bookmarks
        intent = new Intent().setClass(this, WeaveBookmarksListActivity.class);

        spec = tabHost.newTabSpec("weave").setIndicator(res.getString(R.string.WeaveBookmarksListActivity_Title),
                res.getDrawable(R.drawable.ic_tab_weave))
                .setContent(intent);
        tabHost.addTab(spec);
    }

    tabHost.setCurrentTab(0);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {         
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals("bookmarks")) {
                setTitle(R.string.BookmarksListActivity_Title);
            } else if (tabId.equals("history")) {
                setTitle(R.string.HistoryListActivity_Title);
            } else if (tabId.equals("weave")) {
                setTitle(R.string.WeaveBookmarksListActivity_Title);
            } else {
                setTitle(R.string.ApplicationName);
            }
        }
    });
}
项目:Bozon.kg_App    文件:Messages.java   
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_messages);

        // ListView
        ListView listView3 = (ListView)findViewById(R.id.listView2);
        ListView listView4 = (ListView)findViewById(R.id.listView3);

//  String
        final String[] messageTest = new String[] {
                "Notification_1", "Notification_2", "Notification_3", "Notification_4", "Notification_5",
                "Notification_6", "Notification_7", "Notification_8", "Notification_9", "Notification_10",
                "Notification_11", "Notification_12","Notification_8", "Notification_9", "Notification_10",
                "Notification_11", "Notification_12"
        };

        final String[] messageTest2 = new String[] {
                "TestMessage_1", "Send_2", "Notification_3", "Notification_4", "Notification_5",
                "Notification_6", "Notification_7", "Notification_8", "Notification_9", "Notification_10",
                "Notification_11", "Notification_12","Notification_8", "Notification_9", "Notification_10",
                "Notification_11", "Notification_12"
        };

// Адаптер
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,   android.R.layout.simple_list_item_1,messageTest);

        listView3.setAdapter(adapter);

        ArrayAdapter<String> adapter2 = new ArrayAdapter<String>(this,  android.R.layout.simple_list_item_1,messageTest2);

        listView4.setAdapter(adapter2);

        TabHost tabHost = (TabHost) findViewById(android.R.id.tabhost);
        // инициализация
        tabHost.setup();

        tabSpec = tabHost.newTabSpec("tag1");
        tabSpec.setIndicator("Принятые");
        tabSpec.setContent(R.id.tab1);
        tabHost.addTab(tabSpec);

        tabSpec = tabHost.newTabSpec("tag2");
        tabSpec.setIndicator("Отправленные");
        tabSpec.setContent(R.id.tab2);
        tabHost.addTab(tabSpec);



        // вторая вкладка по умолчанию активна
        tabHost.setCurrentTabByTag("tag1");

        // логгируем переключение вкладок
        tabHost.setOnTabChangedListener(new OnTabChangeListener() {
            public void onTabChanged(String tabId) {
                Log.d(LOG_TAG, "tabId = " + tabId);

            }
        });

    }
项目:QuizUpWinner    文件:FragmentTabHost.java   
public void setOnTabChangedListener(TabHost.OnTabChangeListener paramOnTabChangeListener)
{
  this.ʻ = paramOnTabChangeListener;
}
项目:ZircoBrowser    文件:BookmarksHistoryActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {        
    super.onCreate(savedInstanceState);

    if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {          
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       }

       if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
       }

    setContentView(R.layout.bookmarks_history_activity);

    setTitle(R.string.BookmarksListActivity_Title);

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

    // Bookmarks
    intent = new Intent().setClass(this, BookmarksListActivity.class);

    spec = tabHost.newTabSpec("bookmarks").setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
               res.getDrawable(R.drawable.ic_tab_bookmarks))
               .setContent(intent);
    tabHost.addTab(spec);

    // History
    intent = new Intent().setClass(this, HistoryListActivity.class);

    spec = tabHost.newTabSpec("history").setIndicator(res.getString(R.string.Main_MenuShowHistory),
               res.getDrawable(R.drawable.ic_tab_history))
               .setContent(intent);
    tabHost.addTab(spec);

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Constants.PREFERENCE_USE_WEAVE, false)) {
        // Weave bookmarks
        intent = new Intent().setClass(this, WeaveBookmarksListActivity.class);

        spec = tabHost.newTabSpec("weave").setIndicator(res.getString(R.string.WeaveBookmarksListActivity_Title),
                res.getDrawable(R.drawable.ic_tab_weave))
                .setContent(intent);
        tabHost.addTab(spec);
    }

    tabHost.setCurrentTab(0);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {         
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals("bookmarks")) {
                setTitle(R.string.BookmarksListActivity_Title);
            } else if (tabId.equals("history")) {
                setTitle(R.string.HistoryListActivity_Title);
            } else if (tabId.equals("weave")) {
                setTitle(R.string.WeaveBookmarksListActivity_Title);
            } else {
                setTitle(R.string.ApplicationName);
            }
        }
    });
}
项目:cards-app    文件:CatalogFragment.java   
private void createTabs(View v){
    TabHost tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
    tabHost.setup();



       // ������� ������� � ��������� ���
    TabSpec tabSpec = tabHost.newTabSpec(Constants.TAB_THEME);
       // �������� �������
       final View themeView=createIndicatorView(getResources().getString(R.string.themes));
       isSelected(themeView);
       tabSpec.setIndicator(themeView);
       tabSpec.setContent(R.id.themes_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

       // ������� ������� � ��������� ���
       tabSpec = tabHost.newTabSpec(Constants.TAB_OFFER);
       // �������� �������

       final View offerView=createIndicatorView(getResources().getString(R.string.str_selections));
       tabSpec.setIndicator(offerView);

       tabSpec.setContent(R.id.offer_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

      // ������� ������� � ��������� ���
       tabSpec = tabHost.newTabSpec(Constants.TAB_TEXT);
       // �������� �������
       final View textView=createIndicatorView(getResources().getString(R.string.texts));
       tabSpec.setIndicator(textView);
       tabSpec.setContent(R.id.texts_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            // TODO Auto-generated method stub
            if (Constants.TAB_OFFER.equals(tabId)){
                isSelected(offerView);
                isNotSelected(themeView);
                isNotSelected(textView);}

            else if (Constants.TAB_THEME.equals(tabId)){
                isSelected(themeView);
                isNotSelected(offerView);
                isNotSelected(textView);}
            else {
                isSelected(textView);
                isNotSelected(offerView);
                isNotSelected(themeView);}
            }
    });

}
项目:cards-app    文件:PurchasesShopFragment.java   
private void createTabs(){
    TabHost tabHost = (TabHost) v.findViewById(android.R.id.tabhost);
    tabHost.setup();



       // ������� ������� � ��������� ���
    TabSpec tabSpec = tabHost.newTabSpec(Constants.TAB_THEME);
       // �������� �������
       themeView=createIndicatorView(getResources().getString(R.string.themes));
       isSelected(themeView);
       tabSpec.setIndicator(themeView);
       tabSpec.setContent(R.id.themes_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

       // ������� ������� � ��������� ���
       tabSpec = tabHost.newTabSpec(Constants.TAB_OFFER);
       // �������� �������

       offerView=createIndicatorView(getResources().getString(R.string.str_selections));
       tabSpec.setIndicator(offerView);

       tabSpec.setContent(R.id.offer_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

      // ������� ������� � ��������� ���
       tabSpec = tabHost.newTabSpec(Constants.TAB_TEXT);
       // �������� �������
       textView=createIndicatorView(getResources().getString(R.string.texts));
       tabSpec.setIndicator(textView);
       tabSpec.setContent(R.id.texts_layout);
       // ��������� � �������� �������
       tabHost.addTab(tabSpec);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            // TODO Auto-generated method stub
            current_tab=tabId;
            if (Constants.TAB_OFFER.equals(tabId)){
                isSelected(offerView);
                isNotSelected(themeView);
                isNotSelected(textView);
                }

        else if (Constants.TAB_THEME.equals(tabId))
            {
            isSelected(themeView);
            isNotSelected(offerView);
            isNotSelected(textView);
            }
        else {
            isSelected(textView);
            isNotSelected(offerView);
            isNotSelected(themeView);
        }
        }
    });

}
项目:qsolution    文件:ActivityCreateRak.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_create_rak);
    Log.d("Activity ", this.getClass().getName());
    setTitle("BUAT RAK");
    outlet = (TmOutlet) getIntent().getSerializableExtra("outlet");
    surveyor = (TmSurveyor) getIntent().getSerializableExtra("surveyor");
    GlobalVar.SURVEYOUR = surveyor.getKode();
    GlobalVar.OUTLET = outlet.getKode();
    kategori = (DaftarOutletSurvey) getIntent().getSerializableExtra("kategori");
    kunjungan = (TtMKunjunganSurveyor) getIntent().getSerializableExtra("kunjungan");
    surveyDao = new TtMKunjunganSurveyorDao(getApplicationContext());
    daftarOutletDao = new DaftarOutletSurveyDao(getApplicationContext());
    outletDao = new TmOutletDao(getApplicationContext());
    //surveyDao = new TtMKunjunganSurveyorDao(getApplicationContext());
    locked = getIntent().getBooleanExtra("locked", false);
    xcoord = getIntent().getStringExtra("xcoord");
    ycoord = getIntent().getStringExtra("ycoord");
    //omsetKategori = kunjungan.getOmzetKategori(); 
/*  kunjungan =  getIntent().getStringExtra("kunjungan");*/
    Resources res = getResources(); // Resource object to get Drawables
    TabHost tabHost = getTabHost(); // The activity TabHost
    TabHost.TabSpec spec; // Resusable TabSpec for each tab
    // Initialize a TabSpec for each tab and add it to the TabHost
    spec = tabHost.newTabSpec("Rak").setIndicator("Rak", res.getDrawable(R.drawable.ic_action_attach)).setContent(R.id.form1);
    tabHost.addTab(spec);
    spec = tabHost.newTabSpec("Daftar Rak").setIndicator("Daftar Rak", res.getDrawable(R.drawable.ic_action_select_all)).setContent(R.id.form2);
    tabHost.addTab(spec);
    tabHost.setCurrentTab(0);
    tabHost.setOnTabChangedListener(new OnTabChangeListener() {

        @Override
        public void onTabChanged(String tabId) {
            if (getTabHost().getCurrentTabTag().equals("Daftar Rak")) { 
                loadRak();
            }
        }
    });
    initView();
    loadGroupRak();
    loadRak();
    setListener();
    //Toast.makeText(getApplicationContext(), "Kunjungan "+kunjungan.getKodeOutlet()+" kategori "+kategori.getKodeKategori(), Toast.LENGTH_LONG).show();
}
项目:ZicroBrowser    文件:BookmarksHistoryActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {        
    super.onCreate(savedInstanceState);

    if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_SHOW_FULL_SCREEN, false)) {          
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
       }

       if (Controller.getInstance().getPreferences().getBoolean(Constants.PREFERENCES_GENERAL_HIDE_TITLE_BARS, true)) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
       }

    setContentView(R.layout.bookmarks_history_activity);

    setTitle(R.string.BookmarksListActivity_Title);

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

    // Bookmarks
    intent = new Intent().setClass(this, BookmarksListActivity.class);

    spec = tabHost.newTabSpec("bookmarks").setIndicator(res.getString(R.string.Main_MenuShowBookmarks),
               res.getDrawable(R.drawable.ic_tab_bookmarks))
               .setContent(intent);
    tabHost.addTab(spec);

    // History
    intent = new Intent().setClass(this, HistoryListActivity.class);

    spec = tabHost.newTabSpec("history").setIndicator(res.getString(R.string.Main_MenuShowHistory),
               res.getDrawable(R.drawable.ic_tab_history))
               .setContent(intent);
    tabHost.addTab(spec);

    if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(Constants.PREFERENCE_USE_WEAVE, false)) {
        // Weave bookmarks
        intent = new Intent().setClass(this, WeaveBookmarksListActivity.class);

        spec = tabHost.newTabSpec("weave").setIndicator(res.getString(R.string.WeaveBookmarksListActivity_Title),
                res.getDrawable(R.drawable.ic_tab_weave))
                .setContent(intent);
        tabHost.addTab(spec);
    }

    tabHost.setCurrentTab(0);

    tabHost.setOnTabChangedListener(new OnTabChangeListener() {         
        @Override
        public void onTabChanged(String tabId) {
            if (tabId.equals("bookmarks")) {
                setTitle(R.string.BookmarksListActivity_Title);
            } else if (tabId.equals("history")) {
                setTitle(R.string.HistoryListActivity_Title);
            } else if (tabId.equals("weave")) {
                setTitle(R.string.WeaveBookmarksListActivity_Title);
            } else {
                setTitle(R.string.ApplicationName);
            }
        }
    });
}