List of usage examples for android.app ActionBar addTab
@Deprecated public abstract void addTab(Tab tab);
From source file:com.ibm.watson.developer_cloud.android.examples.IBMSpeechToText.java
/** public static class TTSCommands extends AsyncTask<Void, Void, JSONObject> { /*w w w.j a v a 2 s . c o m*/ protected JSONObject doInBackground(Void... none) { return TextToSpeech.sharedInstance().getVoices(); } }*/ @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); StorageReference mStorageRef; mStorageRef = FirebaseStorage.getInstance().getReference(); // Strictmode needed to run the http/wss request for devices > Gingerbread if (android.os.Build.VERSION.SDK_INT > android.os.Build.VERSION_CODES.GINGERBREAD) { StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build(); StrictMode.setThreadPolicy(policy); } //setContentView(R.layout.activity_main); setContentView(R.layout.activity_tab_text); ActionBar action = getActionBar(); action.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); tabSTT = action.newTab().setText("Meeting Recorder"); // tabTTS = actionBar.newTab().setText("Text to Speech"); tabSTT.setTabListener(new MyTabListener(fragmentTabSTT)); // tabTTS.setTabListener(new MyTabListener(fragmentTabTTS)); action.addTab(tabSTT); // actionBar.addTab(tabTTS); //actionBar.setStackedBackgroundDrawable(new ColorDrawable(Color.parseColor("#B5C0D0"))); }
From source file:com.christopher83.pkfmanager.PkfActivity.java
/** * Manages the activity creation// w w w. ja v a 2 s .c o m */ protected void onCreate(Bundle savedInstanceState) { // Invoke the base class method super.onCreate(savedInstanceState); // Set the content of the activity view setContentView(R.layout.activity_pkf); // If the kernel that doesn't support the Phantom Key Presses Filter module, then show an alert dialog if (!isPkfSupported(this)) showPkfNotSupportedAlert(); // Set up the action bar final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three primary sections of the app _sectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter _viewPager = (ViewPager) findViewById(R.id.pager); _viewPager.setAdapter(_sectionsPagerAdapter); // When swiping between different sections, select the corresponding tab. We can also use // ActionBar.Tab#select() to do this if we have a reference to the Tab _viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar for (int i = 0; i < _sectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by the adapter. // Also specify this Activity object, which implements the TabListener interface, // as the callback (listener) for when this tab is selected actionBar .addTab(actionBar.newTab().setText(_sectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.cachirulop.moneybox.activity.MainActivity.java
/** * Create the tabs with the sections of the application */// w ww . ja va 2 s.c o m private void createTabs() { final ActionBar actionBar = getActionBar(); // Create the adapter that will return a fragment for each of the // primary sections of the application. _sectionsPagerAdapter = new MoneyboxFragmentAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. _viewPager = (ViewPager) findViewById(R.id.pager); _viewPager.setAdapter(_sectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. _viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < _sectionsPagerAdapter.getCount(); i++) { actionBar .addTab(actionBar.newTab().setText(_sectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:net.forkk.autocron.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); assert actionBar != null; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/* w w w . ja v a 2s .c om*/ public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.example.emulator8051.HomeActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); /* Create the adapter that will return a fragment for each of the three primary sections of the app.*/ mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); /* When swiping between different sections, select the corresponding tab. We can also use ActionBar.Tab#select() to do this if we have a reference to the Tab.*/// w ww .j a va2 s .com mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { /* Create a tab with text corresponding to the page title defined by the adapter. Also specify this Activity object, which implements the TabListener interface, as the callback (listener) for when this tab is selected.*/ actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:net.forkk.autocron.EditAutomationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent intent = getIntent();/*from w w w .j a v a 2 s . co m*/ assert intent != null; mAutomationPointer = (ComponentPointer) intent.getSerializableExtra(EXTRA_AUTOMATION_POINTER); mShowTriggerList = mAutomationPointer instanceof Event.Pointer; setContentView(R.layout.activity_edit_automation); // Set up the action bar. final ActionBar actionBar = getActionBar(); assert actionBar != null; actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar.addTab(actionBar.newTab().setText(mPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:com.microsoft.band.sdksample.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/* w ww . j av a 2 s . com*/ public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:org.messic.android.activities.BaseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_base); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the activity. mSectionsPagerAdapter = new SectionsPagerAdapter(getFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override/*from w w w . j a va 2 s.c o m*/ public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:capsrock.beta.MainActivity.java
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); timeSheet = new TimeSheet(); PebbleData = new PebbleDictionary(); //Set up to Receive messages from the pebble and handle them correctly PebbleKit.registerReceivedDataHandler(this, new PebbleKit.PebbleDataReceiver(PEBBLE_APP_UUID) { @Override//from w ww . j a v a 2 s . c om public void receiveData(final Context context, final int transactionId, final PebbleDictionary data) { String mode = data.getString(1); //((TextView)findViewById(R.id.pebbleText)).setText(mode); if (mode.substring(9).equals("Break") || mode.substring(9).equals("Work")) { ((TimeEntryFragment) getSupportFragmentManager() .findFragmentByTag("android:switcher:" + R.id.pager + ":0")) .onTimeEntry(findViewById(R.id.StartButton), false); } else { ((TimeEntryFragment) getSupportFragmentManager() .findFragmentByTag("android:switcher:" + R.id.pager + ":0")) .onTimeEntry(findViewById(R.id.StopButton), false); } PebbleKit.sendAckToPebble(getApplicationContext(), transactionId); } }); //Set up the timer thread thr = new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(1000); mHandler.post(new Runnable() { @Override public void run() { Message mes = new Message(); if (strDate != null) { long seconds = Calendar.getInstance().getTimeInMillis() - strDate.getTimeInMillis(); long minutes = seconds / 1000 / 60; minutes %= 60; long hours = seconds / 1000 / 60 / 60; hours %= 24; seconds /= 1000; seconds %= 60; String sec = hours + ":" + minutes + ":" + seconds; mes.obj = sec; mHandler.sendMessage(mes); } else { mes.obj = "00:00:00"; mHandler.sendMessage(mes); } } }); } catch (Exception e) { } } } }); //Start Login Screen Intent intent = new Intent(); intent.setClassName("capsrock.beta", "capsrock.beta.LoginActivity"); //startActivity(intent); setContentView(R.layout.activity_main); // Create the adapter that will return a fragment for each of the three primary sections // of the app. mAppSectionsPagerAdapter = new AppSectionsPagerAdapter(getSupportFragmentManager()); // Set up the action bar. final ActionBar actionBar = getActionBar(); // Specify that the Home/Up button should not be enabled, since there is no hierarchical // parent. // Specify that we will be displaying tabs in the action bar. actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Set up the ViewPager, attaching the adapter and setting up a listener for when the // user swipes between sections. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mAppSectionsPagerAdapter); mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override public void onPageSelected(int position) { // When swiping between different app sections, select the corresponding tab. // We can also use ActionBar.Tab#select() to do this if we have a reference to the // Tab. actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mAppSectionsPagerAdapter.getCount(); i++) { actionBar.addTab( actionBar.newTab().setText(mAppSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }
From source file:de.toshsoft.tsremote.configuration.ConfigurationActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { // Remove all StandOut Windows StandOutWindow.closeAll(this, StandOutRemoteActivity.class); super.onCreate(savedInstanceState); setContentView(R.layout.configuration_activity); // Set up the action bar. final ActionBar actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); // Create the adapter that will return a fragment for each of the three // primary sections of the app. mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); // Set up the ViewPager with the sections adapter. mViewPager = (ViewPager) findViewById(R.id.pager); mViewPager.setAdapter(mSectionsPagerAdapter); // When swiping between different sections, select the corresponding // tab. We can also use ActionBar.Tab#select() to do this if we have // a reference to the Tab. mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() { @Override//from w w w . ja v a 2 s .c o m public void onPageSelected(int position) { actionBar.setSelectedNavigationItem(position); } }); // For each of the sections in the app, add a tab to the action bar. for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) { // Create a tab with text corresponding to the page title defined by // the adapter. Also specify this Activity object, which implements // the TabListener interface, as the callback (listener) for when // this tab is selected. actionBar .addTab(actionBar.newTab().setText(mSectionsPagerAdapter.getPageTitle(i)).setTabListener(this)); } }