Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. package com.example.krowd1;
  2.  
  3. import android.app.Activity;
  4. import android.app.TabActivity;
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.view.Menu;
  8. import android.view.MenuItem;
  9. import android.widget.TabHost;
  10.  
  11. public class ThirdMain extends TabActivity {
  12. private TabHost mTabHost;
  13. @Override
  14. public void onCreate(Bundle savedInstanceState) {
  15. super.onCreate(savedInstanceState);
  16. setContentView(R.layout.third);
  17. mTabHost = getTabHost();
  18. TabHost.TabSpec spec;
  19. Intent intent;
  20. //News
  21. intent = new Intent(this, News.class);
  22. spec = mTabHost.newTabSpec("news")
  23. .setIndicator("News")
  24. .setContent(intent);
  25. mTabHost.addTab(spec);
  26. //Photos
  27. intent = new Intent(this, Photos.class);
  28. spec = mTabHost.newTabSpec("photos")
  29. .setIndicator("Photos")
  30. .setContent(intent);
  31. mTabHost.addTab(spec);
  32. //Questions
  33. intent = new Intent(this, Questions.class);
  34. spec = mTabHost.newTabSpec("questions")
  35. .setIndicator("Questions")
  36. .setContent(intent);
  37. mTabHost.addTab(spec);
  38. mTabHost.setCurrentTab(2);
  39. getActionBar().setDisplayShowHomeEnabled(false); // hides action bar icon
  40. getActionBar().setDisplayShowTitleEnabled(false); // hides action bar title
  41.  
  42. }
  43.  
  44. @Override
  45. public boolean onCreateOptionsMenu(Menu menu) {
  46. // Inflate the menu; this adds items to the action bar if it is present.
  47. //getMenuInflater().inflate(R.menu.third, menu);
  48.  
  49. return true;
  50. }
  51.  
  52. @Override
  53. public boolean onOptionsItemSelected(MenuItem item) {
  54. // Handle action bar item clicks here. The action bar will
  55. // automatically handle clicks on the Home/Up button, so long
  56. // as you specify a parent activity in AndroidManifest.xml.
  57. int id = item.getItemId();
  58. if (id == R.id.action_settings) {
  59. return true;
  60. }
  61. return super.onOptionsItemSelected(item);
  62. }
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement