List of usage examples for android.widget TabHost setCurrentTab
public void setCurrentTab(int index)
From source file:com.momock.outlet.tab.PagerTabOutlet.java
@Override public void onActivate(IPlug plug) { if (((ITabPlug) plug).getContent() != null) { TabHost tabHost = target.getTabHost(); tabHost.setCurrentTab(getIndexOf(plug)); } else {//from w ww . jav a 2 s .c o m Logger.debug("The plug of PagerTabOutlet has not been attached !"); } }
From source file:hauptseminar.hm.edu.trafficlight.app.activity.SettingsTab.java
private void switchToStatusCarTab() { TabHost host = (TabHost) getActivity().findViewById(android.R.id.tabhost); host.setCurrentTab(0); //0 = StatusCarTab }
From source file:com.momock.outlet.tab.FragmentPagerTabOutlet.java
@Override public void onActivate(IPlug plug) { if (((ITabPlug) plug).getContent() != null && target != null) { TabHost tabHost = target.getTabHost(); tabHost.setCurrentTab(getIndexOf(plug)); }//w ww . j a va 2 s .c om }
From source file:com.saltedge.sdk.sample.tabs.ConnectFragment.java
private void openLoginsFragment() { TabHost host = (TabHost) getActivity().findViewById(android.R.id.tabhost); host.setCurrentTab(1); }
From source file:com.musevisions.android.SudokuSolver.SudokuLoaderActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.loader);/*from w w w . j av a 2s . com*/ mMainActivity = (MainTabActivity) getParent(); mMainActivity.setLoaderActivity(this); mTextView = (TextView) findViewById(R.id.textInfo); mListView = (ListView) findViewById(R.id.listView); mListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { PuzzleHolder holder = (PuzzleHolder) mListView.getAdapter().getItem(position); //Toast.makeText(SudokuLoaderActivity.this, holder.name, Toast.LENGTH_SHORT); mMainActivity.getSolverActivity().updateView(holder.puzzle, holder.name); TabHost tabHost = (TabHost) getParent().findViewById(android.R.id.tabhost); tabHost.setCurrentTab(0); } }); }
From source file:com.saltedge.sdk.sample.tabs.AccountsFragment.java
private void urlObtained(Object urlToGo) { getFragmentManager().popBackStack(); Tools.addStringToPreferences(getActivity(), Constants.KEY_REFRESH_URL, (String) urlToGo); TabHost host = (TabHost) getActivity().findViewById(android.R.id.tabhost); host.setCurrentTab(0); }
From source file:org.n52.geoar.data.sos.SOSFeatureVisualization.java
@Override public View getFeatureView(SpatialEntity2<? extends Geometry> entity, View convertView, ViewGroup parentView, Context activityContext) { ViewHolder viewHolder;/* ww w.java 2s. c o m*/ if (convertView == null) { convertView = LayoutInflater.from(activityContext).inflate(R.layout.sos_featureview, null); viewHolder = new ViewHolder(); viewHolder.textViewServiceSensorId = (TextView) convertView.findViewById(R.id.textViewServiceSensorId); viewHolder.textViewDescription = (TextView) convertView.findViewById(R.id.textViewDescription); viewHolder.textViewName = (TextView) convertView.findViewById(R.id.textViewName); viewHolder.sosObservationView = (SOSObservationView) convertView.findViewById(R.id.sosObservationView); viewHolder.sosObservationView.setCapabilitiesCallable(viewHolder.capabilitiesCallable); viewHolder.sosObservationView.setObservationCallable(viewHolder.observationCallable); viewHolder.sosObservationView.setActivityContext(activityContext); TabHost tabHost = (TabHost) convertView.findViewById(android.R.id.tabhost); tabHost.setup(); tabHost.addTab(tabHost.newTabSpec("FOI").setIndicator("Feature").setContent(R.id.scrollViewFOI)); tabHost.addTab(tabHost.newTabSpec("SOS").setIndicator("Observations").setContent(R.id.layoutSOS)); tabHost.setCurrentTab(0); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); } if (entity instanceof FOI) { viewHolder.featureOfInterest = (FOI) entity; viewHolder.textViewName.setText(viewHolder.featureOfInterest.name); if (viewHolder.featureOfInterest.description != null) { viewHolder.textViewDescription.setText(Html.fromHtml(viewHolder.featureOfInterest.description)); } viewHolder.textViewServiceSensorId.setText(viewHolder.featureOfInterest.id); } return convertView; }
From source file:com.infine.android.devoxx.ui.MapHotelFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { mRootView = (ViewGroup) inflater.inflate(R.layout.fragment_map_detail, null); final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments()); Bundle extras = intent.getExtras();//from w w w.j a v a2 s .co m if (extras != null) { startTab = extras.getInt(EXTRA_ROOM); } TabHost tabHost = (TabHost) mRootView.findViewById(android.R.id.tabhost); tabHost.setup(); tabHost.addTab(tabHost.newTabSpec(TAG_LEVEL_0).setIndicator(buildIndicator(R.string.tab_map_0)) .setContent(R.id.tab_map_level0)); tabHost.addTab(tabHost.newTabSpec(TAG_LEVEL_1).setIndicator(buildIndicator(R.string.tab_map_1)) .setContent(R.id.tab_map_level1)); tabHost.setCurrentTab(startTab); return mRootView; }
From source file:org.climprpiano.midisheetmusic.ChooseSongActivity.java
@Override public void onCreate(Bundle state) { globalActivity = this; super.onCreate(state); Bitmap allFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.allfilesicon); Bitmap recentFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.recentfilesicon); Bitmap browseFilesIcon = BitmapFactory.decodeResource(this.getResources(), R.drawable.browsefilesicon); final TabHost tabHost = getTabHost(); tabHost.addTab(tabHost.newTabSpec("All").setIndicator("All", new BitmapDrawable(allFilesIcon)) .setContent(new Intent(this, AllSongsActivity.class))); tabHost.addTab(tabHost.newTabSpec("Recent").setIndicator("Recent", new BitmapDrawable(recentFilesIcon)) .setContent(new Intent(this, RecentSongsActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP))); tabHost.addTab(tabHost.newTabSpec("Browse").setIndicator("Browse", new BitmapDrawable(browseFilesIcon)) .setContent(new Intent(this, FileBrowserActivity.class))); tabHost.setCurrentTab(1); }
From source file:com.facebook.android.FieldsConnectionsDialog.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fields_connections_list); LayoutParams params = getWindow().getAttributes(); params.width = LayoutParams.FILL_PARENT; params.height = LayoutParams.FILL_PARENT; getWindow().setAttributes((android.view.WindowManager.LayoutParams) params); fieldsList = (ListView) findViewById(R.id.fields_list); connectionsList = (ListView) findViewById(R.id.connections_list); fieldsAdapter = new FieldsListAdapter(); if (this.fieldsArray == null) { fieldsList.setAdapter(new ArrayAdapter<String>(explorerActivity, android.R.layout.simple_list_item_1, new String[] { "No fields available" })); } else {//w w w. j av a 2 s . c om fieldsList.setAdapter(fieldsAdapter); } connectionsAdapter = new ConnectionsListAdapter(); if (this.connectionsArray == null) { connectionsList.setAdapter(new ArrayAdapter<String>(explorerActivity, android.R.layout.simple_list_item_1, new String[] { "No connections available" })); } else { connectionsList.setAdapter(connectionsAdapter); } TabHost tabHost = (TabHost) findViewById(R.id.tabHost); tabHost.setup(); TabSpec spec1 = tabHost.newTabSpec("Tab 1"); spec1.setIndicator(explorerActivity.getString(R.string.fields)); spec1.setContent(R.id.fields_layout); TabSpec spec2 = tabHost.newTabSpec("Tab 2"); spec2.setIndicator(explorerActivity.getString(R.string.connections)); spec2.setContent(R.id.connections_list); tabHost.addTab(spec1); tabHost.addTab(spec2); tabHost.setCurrentTab(0); tabHost.getTabWidget().getChildAt(0).getLayoutParams().height = TAB_HEIGHT; tabHost.getTabWidget().getChildAt(1).getLayoutParams().height = TAB_HEIGHT; mGetFieldsButton = (Button) findViewById(R.id.get_fields_button); mGetFieldsButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { /* * Source Tag: */ FieldsConnectionsDialog.this.dismiss(); if (!fieldsVector.isEmpty()) { explorerActivity.getFields(fieldsVector); } else { Toast.makeText(explorerActivity.getBaseContext(), "No Fields selected.", Toast.LENGTH_SHORT) .show(); } } }); connectionsList.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View v, int position, long arg3) { FieldsConnectionsDialog.this.dismiss(); explorerActivity.getConnection(connectionsArray.get(position)); } }); }