Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.example.krowd1;
- import android.app.Activity;
- import android.app.TabActivity;
- import android.content.Intent;
- import android.os.Bundle;
- import android.view.Menu;
- import android.view.MenuItem;
- import android.widget.TabHost;
- public class ThirdMain extends TabActivity {
- private TabHost mTabHost;
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.third);
- mTabHost = getTabHost();
- TabHost.TabSpec spec;
- Intent intent;
- //News
- intent = new Intent(this, News.class);
- spec = mTabHost.newTabSpec("news")
- .setIndicator("News")
- .setContent(intent);
- mTabHost.addTab(spec);
- //Photos
- intent = new Intent(this, Photos.class);
- spec = mTabHost.newTabSpec("photos")
- .setIndicator("Photos")
- .setContent(intent);
- mTabHost.addTab(spec);
- //Questions
- intent = new Intent(this, Questions.class);
- spec = mTabHost.newTabSpec("questions")
- .setIndicator("Questions")
- .setContent(intent);
- mTabHost.addTab(spec);
- mTabHost.setCurrentTab(2);
- getActionBar().setDisplayShowHomeEnabled(false); // hides action bar icon
- getActionBar().setDisplayShowTitleEnabled(false); // hides action bar title
- }
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- //getMenuInflater().inflate(R.menu.third, menu);
- return true;
- }
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- // Handle action bar item clicks here. The action bar will
- // automatically handle clicks on the Home/Up button, so long
- // as you specify a parent activity in AndroidManifest.xml.
- int id = item.getItemId();
- if (id == R.id.action_settings) {
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement