コード例 #1
0
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.main);
    TabHost tabHost = getTabHost();

    tabHost.addTab(
        tabHost
            .newTabSpec("tab_test1")
            .setIndicator(
                getResources().getString(R.string.tab_playlist),
                getResources().getDrawable(R.drawable.ic_tab_playlist))
            // .setContent(R.id.view1)
            .setContent(new Intent(this, PlaylistActivity.class)));

    tabHost.addTab(
        tabHost
            .newTabSpec("tab_test2")
            .setIndicator(
                getResources().getString(R.string.tab_favorites),
                getResources().getDrawable(R.drawable.ic_tab_sentencenote))
            .setContent(new Intent(this, SentenceNoteActivity.class)));

    tabHost.addTab(
        tabHost
            .newTabSpec("tab_test3")
            .setIndicator(
                getResources().getString(R.string.tab_option),
                getResources().getDrawable(R.drawable.ic_tab_info))
            .setContent(new Intent(this, OptionActivity.class)));

    mWaveLoopMain = (LinearLayout) findViewById(R.id.waveloop_main);

    mNowPlayingMain = (LinearLayout) findViewById(R.id.now_playing_main);
    mNowPlayingBtn = (ImageButton) findViewById(R.id.now_playing_btn);

    mNowPlayingArtist = (TextView) findViewById(R.id.now_playing_artist);
    mNowPlayingAlbum = (TextView) findViewById(R.id.now_playing_album);
    mNowPlayingTitle = (TextView) findViewById(R.id.now_playing_title);

    mNowPlayingPlayBtn = (ImageButton) findViewById(R.id.now_playing_playbtn);

    if (mService == null) {
      Intent i = new Intent(this, WaveLoopPlayerService.class);
      mService = startService(i);
    }
  }
コード例 #2
0
  @Override
  public void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    Thread.setDefaultUncaughtExceptionHandler(
        new org.geometerplus.zlibrary.ui.android.library.UncaughtExceptionHandler(this));
    requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    setDefaultKeyMode(DEFAULT_KEYS_SEARCH_LOCAL);

    final SearchManager manager = (SearchManager) getSystemService(SEARCH_SERVICE);
    manager.setOnCancelListener(null);

    final TabHost host = getTabHost();
    LayoutInflater.from(this).inflate(R.layout.bookmarks, host.getTabContentView(), true);

    myBook = SerializerUtil.deserializeBook(getIntent().getStringExtra(FBReader.BOOK_KEY));
  }