Created
September 25, 2015 23:35
-
-
Save hrules6872/2450c60523263f6c2759 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseActivity extends AppCompatActivity { | |
private Toolbar toolbar; | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(getLayoutResource()); | |
toolbar = (Toolbar) findViewById(R.id.toolbar); | |
if (toolbar != null) { | |
setSupportActionBar(toolbar); | |
getSupportActionBar().setTitle(getTitleResource()); | |
} | |
} | |
protected abstract int getLayoutResource(); | |
protected abstract int getTitleResource(); | |
public Toolbar getToolbar(){return toolbar;} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment