コード例 #1
0
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
    int id = item.getItemId();

    if (id == android.R.id.home) {
      Intent i = new Intent(getApplication(), Main_Host.class);
      i.putExtra(staticTAGS.getHomeCategoryKey(), staticTAGS.getHomeCategoryValue());
      startActivity(i);
      return true;
    }

    return super.onOptionsItemSelected(item);
  }
コード例 #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_content_category_host);
    myTypeface = new MyTypeface();
    toolbar = (Toolbar) findViewById(R.id.category_appbar);
    titleBar = (TextView) findViewById(R.id.title_appbar);
    titleBar.setText(staticTAGS.getCategoryValue());
    myTypeface.whatTypeFace("robotoregular.ttf");
    titleBar.setTypeface(myTypeface.getTypeface());

    setSupportActionBar(toolbar);
    assert getSupportActionBar() != null;
    getSupportActionBar().setHomeButtonEnabled(true);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    pager = (ViewPager) findViewById(R.id.viewpager);
    setupViewPager(pager);

    tabLayout = (TabLayout) findViewById(R.id.tabs);
    tabLayout.setupWithViewPager(pager);
  }