@Override protected void onStart() { try { viewTitle = findViewById(R.id.rl_titlebar); mTitleCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_title); mBackCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_left); mMenuCtv = (AppCompatCheckedTextView) viewTitle.findViewById(R.id.ctv_bgatitlebar_right); titleBar = new TitleBar(); titleBar.title = viewTitle; titleBar.backCtv = mBackCtv; titleBar.titleCtv = mTitleCtv; titleBar.menuCtv = mMenuCtv; mBackCtv.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { onBackClick(); } }); mMenuCtv.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { onMenuClick(); } }); } catch (NullPointerException e) { throw new NullPointerException("TitleBar Notfound from Activity layout"); } super.onStart(); }
@Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_NO_TITLE); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); super.onCreate(savedInstanceState); }