Skip to content

Instantly share code, notes, and snippets.

@MonsterTechnoGit
Created July 4, 2018 08:41
Show Gist options
  • Save MonsterTechnoGit/034426362c100525f29832b4eeeab8d3 to your computer and use it in GitHub Desktop.
Save MonsterTechnoGit/034426362c100525f29832b4eeeab8d3 to your computer and use it in GitHub Desktop.
class MainActivity extends AppCompatActivity() {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
setSupportActionBar(toolbar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
// show menu only when home fragment is selected
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment